diff --git a/modules/openapi-json-schema-generator/src/main/java/org/openapitools/codegen/CodegenResponse.java b/modules/openapi-json-schema-generator/src/main/java/org/openapitools/codegen/CodegenResponse.java index aa6b103b77c..c0121ac9c10 100644 --- a/modules/openapi-json-schema-generator/src/main/java/org/openapitools/codegen/CodegenResponse.java +++ b/modules/openapi-json-schema-generator/src/main/java/org/openapitools/codegen/CodegenResponse.java @@ -93,6 +93,7 @@ public class CodegenResponse implements IJsonSchemaValidationProperties { private Map requiredVarsMap; private String ref; private boolean schemaIsFromAdditionalProperties; + public Set imports = new TreeSet<>(); @Override public int hashCode() { @@ -105,7 +106,7 @@ public int hashCode() { getMinLength(), exclusiveMinimum, exclusiveMaximum, getMinimum(), getMaximum(), getPattern(), is1xx, is2xx, is3xx, is4xx, is5xx, additionalPropertiesIsAnyType, hasVars, hasRequired, hasDiscriminatorWithNonEmptyMapping, composedSchemas, hasMultipleTypes, responseHeaders, content, - requiredVarsMap, ref, uniqueItemsBoolean, schemaIsFromAdditionalProperties); + requiredVarsMap, ref, uniqueItemsBoolean, schemaIsFromAdditionalProperties, imports); } @Override @@ -155,6 +156,7 @@ public boolean equals(Object o) { getAdditionalPropertiesIsAnyType() == that.getAdditionalPropertiesIsAnyType() && getHasVars() == that.getHasVars() && getHasRequired() == that.getHasRequired() && + Objects.equals(imports, that.imports) && Objects.equals(uniqueItemsBoolean, that.getUniqueItemsBoolean()) && Objects.equals(ref, that.getRef()) && Objects.equals(requiredVarsMap, that.getRequiredVarsMap()) && @@ -612,6 +614,7 @@ public String toString() { sb.append(", requiredVarsMap=").append(requiredVarsMap); sb.append(", ref=").append(ref); sb.append(", schemaIsFromAdditionalProperties=").append(schemaIsFromAdditionalProperties); + sb.append(", imports=").append(imports); sb.append('}'); return sb.toString(); } diff --git a/modules/openapi-json-schema-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java b/modules/openapi-json-schema-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java index 21bcb2241af..3be79f57e4c 100644 --- a/modules/openapi-json-schema-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java +++ b/modules/openapi-json-schema-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java @@ -4265,13 +4265,12 @@ public CodegenOperation fromOperation(String path, for (Entry entry : headers.entrySet()) { String headerName = entry.getKey(); Header header = ModelUtils.getReferencedHeader(this.openAPI, entry.getValue()); - CodegenParameter responseHeader = headerToCodegenParameter(header, headerName, imports, String.format(Locale.ROOT, "%sResponseParameter", r.code)); + CodegenParameter responseHeader = headerToCodegenParameter(header, headerName, r.imports, String.format(Locale.ROOT, "%sResponseParameter", r.code)); responseHeaders.add(responseHeader); } r.setResponseHeaders(responseHeaders); } - String mediaTypeSchemaSuffix = String.format(Locale.ROOT, "%sResponseBody", r.code); - r.setContent(getContent(response.getContent(), imports, mediaTypeSchemaSuffix)); + r.setContent(getContent(response.getContent(), r.imports, "")); if (!addSchemaImportsFromV3SpecLocations) { if (r.baseType != null && @@ -4391,7 +4390,7 @@ public CodegenOperation fromOperation(String path, param = ModelUtils.getReferencedParameter(this.openAPI, param); CodegenParameter p = fromParameter(param, imports); - p.setContent(getContent(param.getContent(), imports, "RequestParameter" + toModelName(param.getName()))); + p.setContent(getContent(param.getContent(), imports, param.getName())); // ensure unique params if (ensureUniqueParams) { @@ -7092,10 +7091,6 @@ protected void updateRequestBodyForString(CodegenParameter codegenParameter, Sch codegenParameter.pattern = toRegularExpression(schema.getPattern()); } - protected String toMediaTypeSchemaName(String contentType, String mediaTypeSchemaSuffix) { - return "SchemaFor" + mediaTypeSchemaSuffix + toModelName(contentType); - } - private CodegenParameter headerToCodegenParameter(Header header, String headerName, Set imports, String mediaTypeSchemaSuffix) { if (header == null) { return null; @@ -7121,7 +7116,7 @@ private CodegenParameter headerToCodegenParameter(Header header, String headerNa return param; } - protected LinkedHashMap getContent(Content content, Set imports, String mediaTypeSchemaSuffix) { + protected LinkedHashMap getContent(Content content, Set imports, String schemaName) { if (content == null) { return null; } @@ -7140,7 +7135,7 @@ protected LinkedHashMap getContent(Content content, Se for (Entry headerEntry : encHeaders.entrySet()) { String headerName = headerEntry.getKey(); Header header = ModelUtils.getReferencedHeader(this.openAPI, headerEntry.getValue()); - CodegenParameter param = headerToCodegenParameter(header, headerName, imports, mediaTypeSchemaSuffix); + CodegenParameter param = headerToCodegenParameter(header, headerName, imports, schemaName); headers.add(param); } } @@ -7157,8 +7152,12 @@ protected LinkedHashMap getContent(Content content, Se } String contentType = contentEntry.getKey(); CodegenProperty schemaProp = null; + String usedSchemaName = schemaName; + if (usedSchemaName.equals("")) { + usedSchemaName = contentType; + } if (mt.getSchema() != null) { - schemaProp = fromProperty(toMediaTypeSchemaName(contentType, mediaTypeSchemaSuffix), mt.getSchema(), false); + schemaProp = fromProperty(usedSchemaName, mt.getSchema(), false); } HashMap schemaTestCases = null; if (mt.getExtensions() != null && mt.getExtensions().containsKey(xSchemaTestExamplesKey)) { @@ -7207,7 +7206,7 @@ public CodegenParameter fromRequestBody(RequestBody body, Set imports, S if (schema == null) { throw new RuntimeException("Request body cannot be null. Possible cause: missing schema in body parameter (OAS v2): " + body); } - codegenParameter.setContent(getContent(body.getContent(), imports, "RequestBody")); + codegenParameter.setContent(getContent(body.getContent(), imports, "")); if (StringUtils.isNotBlank(schema.get$ref())) { name = ModelUtils.getSimpleRef(schema.get$ref()); diff --git a/modules/openapi-json-schema-generator/src/main/java/org/openapitools/codegen/languages/PythonClientCodegen.java b/modules/openapi-json-schema-generator/src/main/java/org/openapitools/codegen/languages/PythonClientCodegen.java index 1bbae6ebca9..2f0fb16375c 100644 --- a/modules/openapi-json-schema-generator/src/main/java/org/openapitools/codegen/languages/PythonClientCodegen.java +++ b/modules/openapi-json-schema-generator/src/main/java/org/openapitools/codegen/languages/PythonClientCodegen.java @@ -552,7 +552,8 @@ protected void generateEndpoints(OperationsMap objs) { OperationMap operations = objs.getOperations(); List codegenOperations = operations.getOperation(); HashMap pathModuleToPath = new HashMap<>(); - // paths.some_path.post.py (single endpoint definition) + // paths.some_path.post.__init__.py (single endpoint definition) + // responses are adjacent to the init file for (CodegenOperation co: codegenOperations) { if (co.tags != null) { for (Tag tag: co.tags) { @@ -574,14 +575,29 @@ protected void generateEndpoints(OperationsMap objs) { endpointMap.put("operation", co); endpointMap.put("imports", co.imports); endpointMap.put("packageName", packageName); - outputFilename = packageFilename(Arrays.asList("paths", pathModuleName, co.httpMethod + ".py")); + outputFilename = packageFilename(Arrays.asList("paths", pathModuleName, co.httpMethod, "__init__.py")); pathsFiles.add(Arrays.asList(endpointMap, "endpoint.handlebars", outputFilename)); + + for (CodegenResponse response: co.responses) { + // paths.some_path.post.response_for_200.py (file per response) + Map responseMap = new HashMap<>(); + responseMap.put("response", response); + responseMap.put("packageName", packageName); + String responseModuleName = "response_for_"; + if (response.isDefault) { + responseModuleName += "default"; + } else { + responseModuleName += response.code; + } + String responseFilename = packageFilename(Arrays.asList("paths", pathModuleName, co.httpMethod, responseModuleName+ ".py")); + pathsFiles.add(Arrays.asList(responseMap, "endpoint_response.handlebars", responseFilename)); + } /* This stub file exists to allow pycharm to read and use typing.overload decorators for it to see that dict_instance["someProp"] is of type SomeClass.properties.someProp See https://youtrack.jetbrains.com/issue/PY-42137/PyCharm-type-hinting-doesnt-work-well-with-overload-decorator */ - String stubOutputFilename = packageFilename(Arrays.asList("paths", pathModuleName, co.httpMethod + ".pyi")); + String stubOutputFilename = packageFilename(Arrays.asList("paths", pathModuleName, co.httpMethod, "__init__.pyi")); pathsFiles.add(Arrays.asList(endpointMap, "endpoint_stub.handlebars", stubOutputFilename)); Map endpointTestMap = new HashMap<>(); @@ -749,72 +765,7 @@ public String getHelp() { @Override public Schema unaliasSchema(Schema schema) { - Map allSchemas = ModelUtils.getSchemas(openAPI); - if (allSchemas == null || allSchemas.isEmpty()) { - // skip the warning as the spec can have no model defined - //LOGGER.warn("allSchemas cannot be null/empty in unaliasSchema. Returned 'schema'"); - return schema; - } - - if (schema != null && StringUtils.isNotEmpty(schema.get$ref())) { - String simpleRef = ModelUtils.getSimpleRef(schema.get$ref()); - if (schemaMapping.containsKey(simpleRef)) { - LOGGER.debug("Schema unaliasing of {} omitted because aliased class is to be mapped to {}", simpleRef, schemaMapping.get(simpleRef)); - return schema; - } - Schema ref = allSchemas.get(simpleRef); - if (ref == null) { - once(LOGGER).warn("{} is not defined", schema.get$ref()); - return schema; - } else if (ref.getEnum() != null && !ref.getEnum().isEmpty()) { - // top-level enum class - return schema; - } else if (ModelUtils.isArraySchema(ref)) { - if (ModelUtils.isGenerateAliasAsModel(ref)) { - return schema; // generate a model extending array - } else { - return unaliasSchema(allSchemas.get(ModelUtils.getSimpleRef(schema.get$ref()))); - } - } else if (ModelUtils.isComposedSchema(ref)) { - return schema; - } else if (ModelUtils.isMapSchema(ref)) { - if (ref.getProperties() != null && !ref.getProperties().isEmpty()) // has at least one property - return schema; // treat it as model - else { - if (ModelUtils.isGenerateAliasAsModel(ref)) { - return schema; // generate a model extending map - } else { - // treat it as a typical map - return unaliasSchema(allSchemas.get(ModelUtils.getSimpleRef(schema.get$ref()))); - } - } - } else if (ModelUtils.isObjectSchema(ref)) { // model - if (ref.getProperties() != null && !ref.getProperties().isEmpty()) { // has at least one property - return schema; - } else { - // free form object (type: object) - if (ModelUtils.hasValidation(ref)) { - return schema; - } else if (getAllOfDescendants(simpleRef, openAPI).size() > 0) { - return schema; - } - return unaliasSchema(allSchemas.get(ModelUtils.getSimpleRef(schema.get$ref()))); - } - } else if (ModelUtils.hasValidation(ref)) { - // non object non array non map schemas that have validations - // are returned so we can generate those schemas as models - // we do this to: - // - preserve the validations in that model class in python - // - use those validations when we use this schema in composed oneOf schemas - return schema; - } else if (Boolean.TRUE.equals(ref.getNullable()) && ref.getEnum() == null) { - // non enum primitive with nullable True - // we make these models so instances of this will be subclasses of this model - return schema; - } else { - return unaliasSchema(allSchemas.get(ModelUtils.getSimpleRef(schema.get$ref()))); - } - } + // python allows schemas to be inlined at any location so unaliasing should do nothing return schema; } @@ -892,6 +843,17 @@ public String toModelImport(String name) { return "from " + packagePath() + "." + modelPackage() + "." + toModelFilename(name) + " import " + toModelName(name); } + private void fixSchemaImports(Set imports) { + if (imports.size() == 0) { + return; + } + String[] modelNames = imports.toArray(new String[0]); + imports.clear(); + for (String modelName : modelNames) { + imports.add(toModelImport(modelName)); + } + } + @Override @SuppressWarnings("static-method") public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List allModels) { @@ -902,13 +864,9 @@ public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List operations = val.getOperation(); for (CodegenOperation operation : operations) { - if (operation.imports.size() == 0) { - continue; - } - String[] modelNames = operation.imports.toArray(new String[0]); - operation.imports.clear(); - for (String modelName : modelNames) { - operation.imports.add(toModelImport(modelName)); + fixSchemaImports(operation.imports); + for (CodegenResponse response: operation.responses) { + fixSchemaImports(response.imports); } } generateEndpoints(objs); @@ -996,18 +954,6 @@ public CodegenParameter fromParameter(Parameter parameter, Set imports) break; } } - // clone this so we can change some properties on it - CodegenProperty schemaProp = cp.getSchema(); - // parameters may have valid python names like some_val or invalid ones like Content-Type - // we always set nameInSnakeCase to null so special handling will not be done for these names - // invalid python names will be handled in python by using a TypedDict which will allow us to have a type hint - // for keys that cannot be variable names to the schema baseName - if (schemaProp != null) { - schemaProp = schemaProp.clone(); - schemaProp.nameInSnakeCase = null; - schemaProp.baseName = toModelName(cp.baseName) + "Schema"; - cp.setSchema(schemaProp); - } return cp; } @@ -2650,13 +2596,17 @@ public List fromRequestBodyToFormParameters(RequestBody body, Schema schema = ModelUtils.getSchemaFromRequestBody(body); schema = ModelUtils.getReferencedSchema(this.openAPI, schema); CodegenParameter cp = fromFormProperty("body", schema, imports); - cp.setContent(getContent(body.getContent(), imports, "RequestBody")); + cp.setContent(getContent(body.getContent(), imports, "")); cp.isFormParam = false; cp.isBodyParam = true; parameters.add(cp); return parameters; } + protected boolean needToImport(String type) { + return true; + } + /** * Custom version of this method so we can move the body parameter into bodyParam * diff --git a/modules/openapi-json-schema-generator/src/main/resources/python/api_client.handlebars b/modules/openapi-json-schema-generator/src/main/resources/python/api_client.handlebars index 81426853056..5f894965213 100644 --- a/modules/openapi-json-schema-generator/src/main/resources/python/api_client.handlebars +++ b/modules/openapi-json-schema-generator/src/main/resources/python/api_client.handlebars @@ -1,7 +1,7 @@ # coding: utf-8 {{>partial_header}} -from dataclasses import dataclass +import dataclasses from decimal import Decimal import enum import email @@ -339,7 +339,7 @@ class JSONDetector: return False -@dataclass +@dataclasses.dataclass class ParameterBase(JSONDetector): name: str in_type: ParameterInType @@ -779,7 +779,7 @@ class Encoding: self.allow_reserved = allow_reserved -@dataclass +@dataclasses.dataclass class MediaType: """ Used to store request and response body schema information @@ -793,7 +793,7 @@ class MediaType: encoding: typing.Optional[typing.Dict[str, Encoding]] = None -@dataclass +@dataclasses.dataclass class ApiResponse: response: urllib3.HTTPResponse body: typing.Union[Unset, Schema] @@ -802,8 +802,8 @@ class ApiResponse: def __init__( self, response: urllib3.HTTPResponse, - body: typing.Union[Unset, typing.Type[Schema]], - headers: typing.Union[Unset, typing.List[HeaderParameter]] + body: typing.Union[Unset, typing.Type[Schema]] = unset, + headers: typing.Union[Unset, typing.List[HeaderParameter]] = unset ): """ pycharm needs this to prevent 'Unexpected argument' warnings @@ -813,7 +813,7 @@ class ApiResponse: self.headers = headers -@dataclass +@dataclasses.dataclass class ApiResponseWithoutDeserialization(ApiResponse): response: urllib3.HTTPResponse body: typing.Union[Unset, typing.Type[Schema]] = unset diff --git a/modules/openapi-json-schema-generator/src/main/resources/python/api_doc.handlebars b/modules/openapi-json-schema-generator/src/main/resources/python/api_doc.handlebars index 1c279b5a374..b1141380890 100644 --- a/modules/openapi-json-schema-generator/src/main/resources/python/api_doc.handlebars +++ b/modules/openapi-json-schema-generator/src/main/resources/python/api_doc.handlebars @@ -13,11 +13,14 @@ Method | HTTP request | Description {{#each operation}} # **{{{operationId}}}** -> {{#if returnType}}{{{returnType}}} {{/if}}{{{operationId}}}({{#each requiredParams}}{{#unless defaultValue}}{{paramName}}{{#if hasMore}}, {{/if}}{{/unless}}{{/each}}) -{{#if summary}}{{{summary}}}{{/if}}{{#if notes}} +{{#if summary}} +{{{summary}}} +{{/if}} +{{#if notes}} -{{{notes}}}{{/if}} +{{{notes}}} +{{/if}} ### Example @@ -46,19 +49,19 @@ Method | HTTP request | Description Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- {{#with bodyParam}} -{{baseName}} | typing.Union[{{#each content}}{{#unless @first}}, {{/unless}}{{this.schema.baseName}}{{/each}}{{#unless required}}, Unset]{{else}}]{{/unless}} | {{#if required}}required{{else}}optional, default is unset{{/if}} | +[{{baseName}}](#{{operationId}}.RequestBody) | typing.Union[{{#each content}}{{#unless @first}}, {{/unless}}{{#with this.schema}}[RequestBody.Schemas.{{#if nameInSnakeCase}}{{name}}{{else}}{{baseName}}{{/if}}](#{{../operationId}}.RequestBody.Schemas.{{#if nameInSnakeCase}}{{name}}{{else}}{{baseName}}{{/if}}){{/with}}{{/each}}{{#unless required}}, Unset]{{else}}]{{/unless}} | {{#if required}}required{{else}}optional, default is unset{{/if}} | {{/with}} {{#if queryParams}} -query_params | RequestQueryParams | | +[query_params](#{{operationId}}.RequestQueryParameters) | [RequestQueryParameters.Params](#{{operationId}}.RequestQueryParameters.Params) | | {{/if}} {{#if headerParams}} -header_params | RequestHeaderParams | | +[header_params](#{{operationId}}.RequestHeaderParameters) | [RequestHeaderParameters.Params](#{{operationId}}.RequestHeaderParameters.Params) | | {{/if}} {{#if pathParams}} -path_params | RequestPathParams | | +[path_params](#{{operationId}}.RequestPathParameters) | [RequestPathParameters.Params](#{{operationId}}.RequestPathParameters.Params) | | {{/if}} {{#if cookieParams}} -cookie_params | RequestCookieParams | | +[cookie_params](#{{operationId}}.RequestCookieParameters) | [RequestCookieParameters.Params](#{{operationId}}.RequestCookieParameters.Params) | | {{/if}} {{#with bodyParam}} {{#each content}} @@ -78,75 +81,75 @@ timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | t skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned {{#with bodyParam}} -### body +### body {{#each content}} {{#with this.schema}} -{{> api_doc_schema_type_hint complexTypePrefix="../../models/" }} +{{> api_doc_schema_type_hint anchorPrefix=../operationId schemaNamePrefix1="RequestBody.Schemas." complexTypePrefix="../../models/" }} {{/with}} {{/each}} {{/with}} {{#if queryParams}} -### query_params -#### RequestQueryParams +### query_params +#### RequestQueryParameters.Params -Name | Type | Description | Notes +Key | Input Type | Description | Notes ------------- | ------------- | ------------- | ------------- {{#each queryParams}} -{{baseName}} | {{#with schema}}{{baseName}}{{/with}} | | {{#unless required}}optional{{/unless}} +{{baseName}} | {{#with schema}}[RequestQueryParameters.Schemas.{{#if nameInSnakeCase}}{{name}}{{else}}{{baseName}}{{/if}}](#{{../../operationId}}.RequestQueryParameters.Schemas.{{#if nameInSnakeCase}}{{name}}{{else}}{{baseName}}{{/if}}){{/with}} | | {{#unless required}}optional{{/unless}} {{/each}} {{#each queryParams}} {{#with schema}} -{{> api_doc_schema_type_hint complexTypePrefix="../../models/" }} +{{> api_doc_schema_type_hint anchorPrefix=../../operationId schemaNamePrefix1="RequestQueryParameters.Schemas." complexTypePrefix="../../models/" }} {{/with}} {{/each}} {{/if}} {{#if headerParams}} -### header_params -#### RequestHeaderParams +### header_params +#### RequestHeaderParameters.Params -Name | Type | Description | Notes +Key | Input Type | Description | Notes ------------- | ------------- | ------------- | ------------- {{#each headerParams}} -{{baseName}} | {{#with schema}}{{baseName}}{{/with}} | | {{#unless required}}optional{{/unless}} +{{baseName}} | {{#with schema}}[RequestHeaderParameters.Schemas.{{#if nameInSnakeCase}}{{name}}{{else}}{{baseName}}{{/if}}](#{{../../operationId}}.RequestHeaderParameters.Schemas.{{#if nameInSnakeCase}}{{name}}{{else}}{{baseName}}{{/if}}){{/with}} | | {{#unless required}}optional{{/unless}} {{/each}} {{#each headerParams}} {{#with schema}} -{{> api_doc_schema_type_hint complexTypePrefix="../../models/" }} +{{> api_doc_schema_type_hint anchorPrefix=../../operationId schemaNamePrefix1="RequestHeaderParameters.Schemas." complexTypePrefix="../../models/" }} {{/with}} {{/each}} {{/if}} {{#if pathParams}} -### path_params -#### RequestPathParams +### path_params +#### RequestPathParameters.Params -Name | Type | Description | Notes +Key | Input Type | Description | Notes ------------- | ------------- | ------------- | ------------- {{#each pathParams}} -{{baseName}} | {{#with schema}}{{baseName}}{{/with}} | | {{#unless required}}optional{{/unless}} +{{baseName}} | {{#with schema}}[RequestPathParameters.Schemas.{{#if nameInSnakeCase}}{{name}}{{else}}{{baseName}}{{/if}}](#{{../../operationId}}.RequestPathParameters.Schemas.{{#if nameInSnakeCase}}{{name}}{{else}}{{baseName}}{{/if}}){{/with}} | | {{#unless required}}optional{{/unless}} {{/each}} {{#each pathParams}} {{#with schema}} -{{> api_doc_schema_type_hint complexTypePrefix="../../models/" }} +{{> api_doc_schema_type_hint anchorPrefix=../../operationId schemaNamePrefix1="RequestPathParameters.Schemas." complexTypePrefix="../../models/" }} {{/with}} {{/each}} {{/if}} {{#if cookieParams}} -### cookie_params -#### RequestCookieParams +### cookie_params +#### RequestCookieParameters.Params -Name | Type | Description | Notes +Key | Input Type | Description | Notes ------------- | ------------- | ------------- | ------------- {{#each cookieParams}} -{{baseName}} | {{#with schema}}{{baseName}}{{/with}} | | {{#unless required}}optional{{/unless}} +{{baseName}} | {{#with schema}}[RequestCookieParameters.Schemas.{{#if nameInSnakeCase}}{{name}}{{else}}{{baseName}}{{/if}}](#{{../../operationId}}.RequestCookieParameters.Schemas.{{#if nameInSnakeCase}}{{name}}{{else}}{{baseName}}{{/if}}){{/with}} | | {{#unless required}}optional{{/unless}} {{/each}} {{#each cookieParams}} {{#with schema}} -{{> api_doc_schema_type_hint complexTypePrefix="../../models/" }} +{{> api_doc_schema_type_hint anchorPrefix=../../operationId schemaNamePrefix1="RequestCookieParameters.Schemas." complexTypePrefix="../../models/" }} {{/with}} {{/each}} {{/if}} @@ -161,27 +164,27 @@ Code | Class | Description n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned {{#each responses}} {{#if isDefault}} -default | [ApiResponseForDefault](#{{operationId}}.ApiResponseForDefault) | {{message}} +default | [response_for_default.ApiResponse](#{{operationId}}.response_for_default.ApiResponse) | {{message}} {{else}} -{{code}} | [ApiResponseFor{{code}}](#{{operationId}}.ApiResponseFor{{code}}) | {{message}} +{{code}} | [response_for_{{code}}.ApiResponse](#{{operationId}}.response_for_{{code}}.ApiResponse) | {{message}} {{/if}} {{/each}} {{#each responses}} {{#if isDefault}} -#### {{operationId}}.ApiResponseForDefault +#### response_for_default.ApiResponse {{else}} -#### {{operationId}}.ApiResponseFor{{code}} +#### response_for_{{code}}.ApiResponse {{/if}} Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | {{#unless content}}Unset{{else}}typing.Union[{{#each content}}{{#if this.schema}}{{this.schema.baseName}}{{else}}Unset{{/if}}, {{/each}}]{{/unless}} | {{#unless content}}body was not defined{{/unless}} | +body | {{#unless content}}Unset{{else}}typing.Union[{{#each content}}{{#if this.schema}}[response_for_{{code}}.BodySchemas.{{#if this.schema.nameInSnakeCase}}{{this.schema.name}}{{else}}{{this.schema.baseName}}{{/if}}](#{{operationId}}.response_for_{{code}}.BodySchemas.{{#if this.schema.nameInSnakeCase}}{{this.schema.name}}{{else}}{{this.schema.baseName}}{{/if}}){{else}}Unset{{/if}}, {{/each}}]{{/unless}} | {{#unless content}}body was not defined{{/unless}} | headers | {{#unless responseHeaders}}Unset{{else}}ResponseHeadersFor{{code}}{{/unless}} | {{#unless responseHeaders}}headers were not defined{{/unless}} | {{#each content}} {{#with this.schema}} -{{> api_doc_schema_type_hint complexTypePrefix="../../models/" }} +{{> api_doc_schema_type_hint anchorPrefix=../../operationId schemaNamePrefix1="response_for_" schemaNamePrefix2=../../code schemaNamePrefix3=".BodySchemas." complexTypePrefix="../../models/" }} {{/with}} {{/each}} {{#if responseHeaders}} diff --git a/modules/openapi-json-schema-generator/src/main/resources/python/api_doc_schema_fancy_schema_name.handlebars b/modules/openapi-json-schema-generator/src/main/resources/python/api_doc_schema_fancy_schema_name.handlebars new file mode 100644 index 00000000000..e3fc10e3e84 --- /dev/null +++ b/modules/openapi-json-schema-generator/src/main/resources/python/api_doc_schema_fancy_schema_name.handlebars @@ -0,0 +1 @@ +{{schemaNamePrefix1}}{{#if schemaNamePrefix2}}{{schemaNamePrefix2}}{{/if}}{{#if schemaNamePrefix3}}{{schemaNamePrefix3}}{{/if}}{{#if nameInSnakeCase}}{{name}}{{else}}{{baseName}}{{/if}} \ No newline at end of file diff --git a/modules/openapi-json-schema-generator/src/main/resources/python/api_doc_schema_type_hint.handlebars b/modules/openapi-json-schema-generator/src/main/resources/python/api_doc_schema_type_hint.handlebars index 27aa7a499b7..5828b601de7 100644 --- a/modules/openapi-json-schema-generator/src/main/resources/python/api_doc_schema_type_hint.handlebars +++ b/modules/openapi-json-schema-generator/src/main/resources/python/api_doc_schema_type_hint.handlebars @@ -1,5 +1,5 @@ -# {{baseName}} +# {{#if schemaNamePrefix1}}{{#if anchorPrefix}}{{/if}}{{> api_doc_schema_fancy_schema_name }}{{#if anchorPrefix}}{{/if}}{{else}}{{baseName}}{{/if}} {{#if complexType}} Type | Description | Notes ------------- | ------------- | ------------- diff --git a/modules/openapi-json-schema-generator/src/main/resources/python/api_test.handlebars b/modules/openapi-json-schema-generator/src/main/resources/python/api_test.handlebars index 142ec8b435a..86d85596910 100644 --- a/modules/openapi-json-schema-generator/src/main/resources/python/api_test.handlebars +++ b/modules/openapi-json-schema-generator/src/main/resources/python/api_test.handlebars @@ -36,6 +36,9 @@ class Test{{operationIdSnakeCase}}(ApiTestMixin, unittest.TestCase): response_status = {{code}} {{#if content}} {{#each content}} + {{#if schema}} + response_body_schema = {{httpMethod}}.response_for_{{#if ../isDefault}}default{{else}}{{code}}{{/if}}.BodySchemas.{{#if schema.nameInSnakeCase}}{{schema.name}}{{else}}{{schema.baseName}}{{/if}} + {{/if}} {{#if this.testCases}} {{#each testCases}} @@ -58,8 +61,8 @@ class Test{{operationIdSnakeCase}}(ApiTestMixin, unittest.TestCase): {{> api_test_partial }} assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, {{httpMethod}}.{{schema.baseName}}) - deserialized_response_body = {{httpMethod}}.{{schema.baseName}}.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -106,7 +109,7 @@ class Test{{operationIdSnakeCase}}(ApiTestMixin, unittest.TestCase): {{/with}} ) {{#if valid}} - body = {{httpMethod}}.{{schema.baseName}}.from_openapi_data_oapg( + body = {{httpMethod}}.RequestBody.Schemas.{{#if schema.nameInSnakeCase}}{{schema.name}}{{else}}{{schema.baseName}}{{/if}}.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -120,7 +123,7 @@ class Test{{operationIdSnakeCase}}(ApiTestMixin, unittest.TestCase): assert isinstance(api_response.body, schemas.Unset) {{else}} with self.assertRaises(({{packageName}}.ApiValueError, {{packageName}}.ApiTypeError)): - body = {{httpMethod}}.{{schema.baseName}}.from_openapi_data_oapg( + body = {{httpMethod}}.RequestBody.Schemas.{{#if schema.nameInSnakeCase}}{{schema.name}}{{else}}{{schema.baseName}}{{/if}}.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/modules/openapi-json-schema-generator/src/main/resources/python/endpoint.handlebars b/modules/openapi-json-schema-generator/src/main/resources/python/endpoint.handlebars index 8190bd78e3d..601a5e4b533 100644 --- a/modules/openapi-json-schema-generator/src/main/resources/python/endpoint.handlebars +++ b/modules/openapi-json-schema-generator/src/main/resources/python/endpoint.handlebars @@ -16,46 +16,63 @@ from {{packageName}} import api_client, exceptions {{> model_templates/imports_schemas }} {{#unless isStub}} -from . import path - +from .. import path {{/unless}} {{#with operation}} -{{#if queryParams}} -{{> endpoint_parameter_schema_and_def xParams=queryParams xParamsName="Query" }} -{{/if}} -{{#if headerParams}} -{{> endpoint_parameter_schema_and_def xParams=headerParams xParamsName="Header" }} -{{/if}} -{{#if pathParams}} -{{> endpoint_parameter_schema_and_def xParams=pathParams xParamsName="Path" }} -{{/if}} -{{#if cookieParams}} -{{> endpoint_parameter_schema_and_def xParams=cookieParams xParamsName="Cookie" }} -{{/if}} -{{#with bodyParam}} -# body param -{{#each content}} -{{#with this.schema}} -{{> model_templates/schema }} -{{/with}} +{{#each responses}} +from . import response_for_{{#if isDefault}}default{{else}}{{code}}{{/if}} {{/each}} +{{#or queryParams headerParams pathParams cookieParams}} + {{#if queryParams}} +{{> endpoint_parameter_schema_and_def xParams=queryParams xParamsName="RequestQueryParameters" }} + {{/if}} + {{#if headerParams}} +{{> endpoint_parameter_schema_and_def xParams=headerParams xParamsName="RequestHeaderParameters" }} + {{/if}} + {{#if pathParams}} +{{> endpoint_parameter_schema_and_def xParams=pathParams xParamsName="RequestPathParameters" }} + {{/if}} + {{#if cookieParams}} +{{> endpoint_parameter_schema_and_def xParams=cookieParams xParamsName="RequestCookieParameters" }} + {{/if}} +{{/or}} +{{#if bodyParam}} +{{#with bodyParam}} -request_body_{{paramName}} = api_client.RequestBody( - content={ -{{#each content}} - '{{{@key}}}': api_client.MediaType({{#if this.schema}} - schema={{this.schema.baseName}}{{/if}}), -{{/each}} - }, -{{#if required}} - required=True, -{{/if}} -) + +class RequestBody: + class Schemas: + {{#each content}} + {{#with this}} + {{#with schema}} + {{> model_templates/schema }} + {{/with}} + {{/with}} + {{/each}} + + parameter = api_client.RequestBody( + content={ + {{#each content}} + '{{{@key}}}': api_client.MediaType( + {{#with this}} + {{#with schema}} + schema=Schemas.{{#if nameInSnakeCase}}{{name}}{{else}}{{baseName}}{{/if}} + {{/with}} + {{/with}} + ), + {{/each}} + }, + {{#if required}} + required=True, + {{/if}} + ) {{/with}} +{{/if}} {{#unless isStub}} {{#each authMethods}} {{#if @first}} + _auth = [ {{/if}} '{{name}}', @@ -65,6 +82,7 @@ _auth = [ {{/each}} {{#each servers}} {{#if @first}} + _servers = ( {{/if}} { @@ -97,126 +115,14 @@ _servers = ( {{/if}} {{/each}} {{/unless}} -{{#each responses}} -{{#each responseHeaders}} -{{#with schema}} -{{> model_templates/schema }} -{{/with}} {{#unless isStub}} -{{paramName}}_parameter = api_client.HeaderParameter( - name="{{baseName}}", -{{#if style}} - style=api_client.ParameterStyle.{{style}}, -{{/if}} -{{#if schema}} -{{#with schema}} - schema={{baseName}}, -{{/with}} -{{/if}} -{{#if required}} - required=True, -{{/if}} -{{#if isExplode}} - explode=True, -{{/if}} -) -{{/unless}} -{{/each}} -{{#each content}} -{{#with this.schema}} -{{> model_templates/schema }} -{{/with}} -{{/each}} -{{#if responseHeaders}} -ResponseHeadersFor{{code}} = typing_extensions.TypedDict( - 'ResponseHeadersFor{{code}}', - { -{{#each responseHeaders}} - '{{baseName}}': {{#with schema}}{{baseName}},{{/with}} -{{/each}} - } -) -{{/if}} - -@dataclass -{{#if isDefault}} -class ApiResponseForDefault(api_client.ApiResponse): -{{else}} -class ApiResponseFor{{code}}(api_client.ApiResponse): -{{/if}} - response: urllib3.HTTPResponse -{{#and responseHeaders content}} - body: typing.Union[ -{{#each content}} -{{#if this.schema}} - {{this.schema.baseName}}, -{{else}} - schemas.Unset, -{{/if}} -{{/each}} - ] - headers: ResponseHeadersFor{{code}} -{{else}} -{{#or responseHeaders content}} -{{#if responseHeaders}} - headers: ResponseHeadersFor{{code}} - body: schemas.Unset = schemas.unset -{{else}} - body: typing.Union[ -{{#each content}} -{{#if this.schema}} - {{this.schema.baseName}}, -{{else}} - schemas.Unset, -{{/if}} -{{/each}} - ] - headers: schemas.Unset = schemas.unset -{{/if}} -{{/or}} -{{/and}} -{{#unless responseHeaders}} -{{#unless content}} - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset -{{/unless}} -{{/unless}} - - -{{#if isDefault}} -_response_for_default = api_client.OpenApiResponse( - response_cls=ApiResponseForDefault, -{{else}} -_response_for_{{code}} = api_client.OpenApiResponse( - response_cls=ApiResponseFor{{code}}, -{{/if}} -{{#each content}} -{{#if @first}} - content={ -{{/if}} - '{{{@key}}}': api_client.MediaType({{#if this.schema}} - schema={{this.schema.baseName}}{{/if}}), -{{#if @last}} - }, -{{/if}} -{{/each}} -{{#if responseHeaders}} - headers=[ -{{#each responseHeaders}} - {{paramName}}_parameter, -{{/each}} - ] -{{/if}} -) -{{/each}} -{{#unless isStub}} _status_code_to_response = { {{#each responses}} {{#if isDefault}} - 'default': _response_for_default, + 'default': response_for_default.response, {{else}} - '{{code}}': _response_for_{{code}}, + '{{code}}': response_for_{{code}}.response, {{/if}} {{/each}} } @@ -265,26 +171,22 @@ class BaseApi(api_client.Api): class instances """ {{#if queryParams}} - self._verify_typed_dict_inputs_oapg(RequestQueryParams, query_params) + self._verify_typed_dict_inputs_oapg(RequestQueryParameters.Params, query_params) {{/if}} {{#if headerParams}} - self._verify_typed_dict_inputs_oapg(RequestHeaderParams, header_params) + self._verify_typed_dict_inputs_oapg(RequestHeaderParameters.Params, header_params) {{/if}} {{#if pathParams}} - self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + self._verify_typed_dict_inputs_oapg(RequestPathParameters.Params, path_params) {{/if}} {{#if cookieParams}} - self._verify_typed_dict_inputs_oapg(RequestCookieParams, cookie_params) + self._verify_typed_dict_inputs_oapg(RequestCookieParameters.Params, cookie_params) {{/if}} used_path = path.value {{#if pathParams}} _path_params = {} - for parameter in ( - {{#each pathParams}} - request_path_{{paramName}}, - {{/each}} - ): + for parameter in RequestPathParameters.parameters: parameter_data = path_params.get(parameter.name, schemas.unset) if parameter_data is schemas.unset: continue @@ -297,11 +199,7 @@ class BaseApi(api_client.Api): {{#if queryParams}} prefix_separator_iterator = None - for parameter in ( - {{#each queryParams}} - request_query_{{paramName}}, - {{/each}} - ): + for parameter in RequestQueryParameters.parameters: parameter_data = query_params.get(parameter.name, schemas.unset) if parameter_data is schemas.unset: continue @@ -317,11 +215,7 @@ class BaseApi(api_client.Api): {{else}} {{/or}} {{#if headerParams}} - for parameter in ( - {{#each headerParams}} - request_header_{{paramName}}, - {{/each}} - ): + for parameter in RequestHeaderParameters.parameters: parameter_data = header_params.get(parameter.name, schemas.unset) if parameter_data is schemas.unset: continue diff --git a/modules/openapi-json-schema-generator/src/main/resources/python/endpoint_args.handlebars b/modules/openapi-json-schema-generator/src/main/resources/python/endpoint_args.handlebars index 1eceaf34ad3..d2038c9bf49 100644 --- a/modules/openapi-json-schema-generator/src/main/resources/python/endpoint_args.handlebars +++ b/modules/openapi-json-schema-generator/src/main/resources/python/endpoint_args.handlebars @@ -3,9 +3,9 @@ {{#if bodyParam.required}} {{#with bodyParam}} {{#eq ../contentType "null"}} - body: typing.Union[{{#each getContent}}{{#with this.schema}}{{baseName}},{{> model_templates/schema_python_types }}{{/with}}{{/each}}], + body: typing.Union[{{#each getContent}}{{#with this.schema}}RequestBody.Schemas.{{#if nameInSnakeCase}}{{name}}{{else}}{{baseName}}{{/if}},{{> model_templates/schema_python_types }}{{/with}}{{/each}}], {{else}} - body: typing.Union[{{#each getContent}}{{#eq @key ../../contentType }}{{#with this.schema}}{{baseName}},{{> model_templates/schema_python_types }}{{/with}}{{/eq}}{{/each}}], + body: typing.Union[{{#each getContent}}{{#eq @key ../../contentType }}{{#with this.schema}}RequestBody.Schemas.{{#if nameInSnakeCase}}{{name}}{{else}}{{baseName}}{{/if}},{{> model_templates/schema_python_types }}{{/with}}{{/eq}}{{/each}}], {{/eq}} {{/with}} {{#if isOverload}} @@ -67,9 +67,9 @@ {{/if}} {{#with bodyParam}} {{#eq ../contentType "null"}} - body: typing.Union[{{#each getContent}}{{#with this.schema}}{{baseName}}, {{> model_templates/schema_python_types }}{{/with}}{{/each}}schemas.Unset] = schemas.unset, + body: typing.Union[{{#each getContent}}{{#with this.schema}}RequestBody.Schemas.{{#if nameInSnakeCase}}{{name}}{{else}}{{baseName}}{{/if}}, {{> model_templates/schema_python_types }}{{/with}}{{/each}}schemas.Unset] = schemas.unset, {{else}} - body: typing.Union[{{#each getContent}}{{#eq @key ../../contentType }}{{#with this.schema}}{{baseName}}, {{> model_templates/schema_python_types }}{{/with}}{{/eq}}{{/each}}schemas.Unset] = schemas.unset, + body: typing.Union[{{#each getContent}}{{#eq @key ../../contentType }}{{#with this.schema}}RequestBody.Schemas.{{#if nameInSnakeCase}}{{name}}{{else}}{{baseName}}{{/if}}, {{> model_templates/schema_python_types }}{{/with}}{{/eq}}{{/each}}schemas.Unset] = schemas.unset, {{/eq}} {{/with}} {{/if}} @@ -81,16 +81,16 @@ {{/if}} {{/if}} {{#if queryParams}} - query_params: RequestQueryParams = frozendict.frozendict(), + query_params: RequestQueryParameters.Params = frozendict.frozendict(), {{/if}} {{#if headerParams}} - header_params: RequestHeaderParams = frozendict.frozendict(), + header_params: RequestHeaderParameters.Params = frozendict.frozendict(), {{/if}} {{#if pathParams}} - path_params: RequestPathParams = frozendict.frozendict(), + path_params: RequestPathParameters.Params = frozendict.frozendict(), {{/if}} {{#if cookieParams}} - cookie_params: RequestCookieParams = frozendict.frozendict(), + cookie_params: RequestCookieParameters.Params = frozendict.frozendict(), {{/if}} {{#if produces}} accept_content_types: typing.Tuple[str] = _all_accept_content_types, @@ -117,10 +117,10 @@ ) -> {{#if getAllResponsesAreErrors}}api_client.ApiResponseWithoutDeserialization: ...{{else}}typing.Union[ {{#each responses}} {{#if isDefault}} - ApiResponseForDefault, + response_for_default.ApiResponse, {{else}} {{#if is2xx}} - ApiResponseFor{{code}}, + response_for_{{code}}.ApiResponse, {{/if}} {{/if}} {{/each}} @@ -132,10 +132,10 @@ ) -> typing.Union[ {{#each responses}} {{#if isDefault}} - ApiResponseForDefault, + response_for_default.ApiResponse, {{else}} {{#if is2xx}} - ApiResponseFor{{code}}, + response_for_{{code}}.ApiResponse, {{/if}} {{/if}} {{/each}} diff --git a/modules/openapi-json-schema-generator/src/main/resources/python/endpoint_body_serialization.handlebars b/modules/openapi-json-schema-generator/src/main/resources/python/endpoint_body_serialization.handlebars index f00d9f05d27..8d9b9d2fe0b 100644 --- a/modules/openapi-json-schema-generator/src/main/resources/python/endpoint_body_serialization.handlebars +++ b/modules/openapi-json-schema-generator/src/main/resources/python/endpoint_body_serialization.handlebars @@ -1,4 +1,4 @@ -serialized_data = request_body_{{paramName}}.serialize(body, content_type) +serialized_data = RequestBody.parameter.serialize(body, content_type) _headers.add('Content-Type', content_type) if 'fields' in serialized_data: _fields = serialized_data['fields'] diff --git a/modules/openapi-json-schema-generator/src/main/resources/python/endpoint_parameter.handlebars b/modules/openapi-json-schema-generator/src/main/resources/python/endpoint_parameter.handlebars index 8c18c997e35..b17fabfc0f8 100644 --- a/modules/openapi-json-schema-generator/src/main/resources/python/endpoint_parameter.handlebars +++ b/modules/openapi-json-schema-generator/src/main/resources/python/endpoint_parameter.handlebars @@ -1,17 +1,17 @@ -request_{{#if isQueryParam}}query{{/if}}{{#if isPathParam}}path{{/if}}{{#if isHeaderParam}}header{{/if}}{{#if isCookieParam}}cookie{{/if}}_{{paramName}} = api_client.{{#if isQueryParam}}Query{{/if}}{{#if isPathParam}}Path{{/if}}{{#if isHeaderParam}}Header{{/if}}{{#if isCookieParam}}Cookie{{/if}}Parameter( +api_client.{{#if isQueryParam}}Query{{/if}}{{#if isPathParam}}Path{{/if}}{{#if isHeaderParam}}Header{{/if}}{{#if isCookieParam}}Cookie{{/if}}Parameter( name="{{baseName}}", {{#if style}} style=api_client.ParameterStyle.{{style}}, {{/if}} {{#if schema}} {{#with schema}} - schema={{baseName}}, + schema=Schemas.{{#if nameInSnakeCase}}{{name}}{{else}}{{baseName}}{{/if}}, {{/with}} {{/if}} {{#if getContent}} content={ {{#each getContent}} - "{{@key}}": {{#with this}}{{#with schema}}{{baseName}}{{/with}}{{/with}}, + "{{@key}}": {{#with this}}{{#with schema}}Schemas.{{#if nameInSnakeCase}}{{name}}{{else}}{{baseName}}{{/if}}{{/with}}{{/with}}, {{/each}} }, {{/if}} @@ -21,4 +21,4 @@ request_{{#if isQueryParam}}query{{/if}}{{#if isPathParam}}path{{/if}}{{#if isHe {{#if isExplode}} explode=True, {{/if}} -) +), diff --git a/modules/openapi-json-schema-generator/src/main/resources/python/endpoint_parameter_schema_and_def.handlebars b/modules/openapi-json-schema-generator/src/main/resources/python/endpoint_parameter_schema_and_def.handlebars index 313a64dc200..ab0b354e51f 100644 --- a/modules/openapi-json-schema-generator/src/main/resources/python/endpoint_parameter_schema_and_def.handlebars +++ b/modules/openapi-json-schema-generator/src/main/resources/python/endpoint_parameter_schema_and_def.handlebars @@ -1,56 +1,63 @@ -# {{xParamsName}} params + + +class {{xParamsName}}: + class Schemas: {{#each xParams}} {{#if schema}} {{#with schema}} -{{> model_templates/schema }} + {{> model_templates/schema }} {{/with}} {{else}} {{#if getContent}} {{#each getContent}} {{#with this}} {{#with schema}} -{{> model_templates/schema }} + {{> model_templates/schema }} {{/with}} {{/with}} {{/each}} {{/if}} {{/if}} {{/each}} -RequestRequired{{xParamsName}}Params = typing_extensions.TypedDict( - 'RequestRequired{{xParamsName}}Params', - { + + + RequiredParams = typing_extensions.TypedDict( + 'RequiredParams', + { {{#each xParams}} {{#if required}} {{#if schema}} - '{{baseName}}': {{#with schema}}typing.Union[{{baseName}}, {{> model_templates/schema_python_types }}],{{/with}} + '{{baseName}}': {{#with schema}}typing.Union[Schemas.{{#if nameInSnakeCase}}{{name}}{{else}}{{baseName}}{{/if}}, {{> model_templates/schema_python_types }}],{{/with}} {{else}} - '{{baseName}}': {{#each getContent}}{{#with this}}{{#with schema}}typing.Union[{{baseName}}, {{> model_templates/schema_python_types }}],{{/with}}{{/with}}{{/each}} + '{{baseName}}': {{#each getContent}}{{#with this}}{{#with schema}}typing.Union[Schemas.{{#if nameInSnakeCase}}{{name}}{{else}}{{baseName}}{{/if}}, {{> model_templates/schema_python_types }}],{{/with}}{{/with}}{{/each}} {{/if}} {{/if}} {{/each}} - } -) -RequestOptional{{xParamsName}}Params = typing_extensions.TypedDict( - 'RequestOptional{{xParamsName}}Params', - { + } + ) + OptionalParams = typing_extensions.TypedDict( + 'OptionalParams', + { {{#each xParams}} {{#unless required}} {{#if schema}} - '{{baseName}}': {{#with schema}}typing.Union[{{baseName}}, {{> model_templates/schema_python_types }}],{{/with}} + '{{baseName}}': {{#with schema}}typing.Union[Schemas.{{#if nameInSnakeCase}}{{name}}{{else}}{{baseName}}{{/if}}, {{> model_templates/schema_python_types }}],{{/with}} {{else}} - '{{baseName}}': {{#each getContent}}{{#with this}}{{#with schema}}typing.Union[{{baseName}}, {{> model_templates/schema_python_types }}],{{/with}}{{/with}}{{/each}} + '{{baseName}}': {{#each getContent}}{{#with this}}{{#with schema}}typing.Union[Schemas.{{#if nameInSnakeCase}}{{name}}{{else}}{{baseName}}{{/if}}, {{> model_templates/schema_python_types }}],{{/with}}{{/with}}{{/each}} {{/if}} {{/unless}} {{/each}} - }, - total=False -) + }, + total=False + ) -class Request{{xParamsName}}Params(RequestRequired{{xParamsName}}Params, RequestOptional{{xParamsName}}Params): - pass + class Params(RequiredParams, OptionalParams): + pass -{{#each xParams}} -{{> endpoint_parameter }} -{{/each}} \ No newline at end of file + parameters = [ + {{#each xParams}} + {{> endpoint_parameter }} + {{/each}} + ] \ No newline at end of file diff --git a/modules/openapi-json-schema-generator/src/main/resources/python/endpoint_response.handlebars b/modules/openapi-json-schema-generator/src/main/resources/python/endpoint_response.handlebars new file mode 100644 index 00000000000..16521863824 --- /dev/null +++ b/modules/openapi-json-schema-generator/src/main/resources/python/endpoint_response.handlebars @@ -0,0 +1,91 @@ +import dataclasses +import urllib3 + +from {{packageName}} import api_client +{{> model_templates/imports_schema_types }} +{{#with response}} +{{> model_templates/imports_schemas }} +{{#if responseHeaders}} +{{> endpoint_parameter_schema_and_def xParams=responseHeaders xParamsName="Header" }} +{{/if}} +{{#if getContent}} + + +class BodySchemas: + # body schemas + {{#each content}} + {{#with this.schema}} + {{> model_templates/schema }} + {{/with}} + {{/each}} + pass +{{/if}} + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse +{{#and responseHeaders content}} + body: typing.Union[ +{{#each content}} +{{#if this.schema}} + {{#with this.schema}} + BodySchemas.{{#if nameInSnakeCase}}{{name}}{{else}}{{baseName}}{{/if}}, + {{/with}} +{{else}} + schemas.Unset, +{{/if}} +{{/each}} + ] + headers: Header.Params +{{else}} +{{#or responseHeaders content}} +{{#if responseHeaders}} + headers: Header.Params + body: schemas.Unset = schemas.unset +{{else}} + body: typing.Union[ +{{#each content}} +{{#if this.schema}} + {{#with this.schema}} + BodySchemas.{{#if nameInSnakeCase}}{{name}}{{else}}{{baseName}}{{/if}}, + {{/with}} +{{else}} + schemas.Unset, +{{/if}} +{{/each}} + ] + headers: schemas.Unset = schemas.unset +{{/if}} +{{/or}} +{{/and}} +{{#unless responseHeaders}} +{{#unless content}} + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset +{{/unless}} +{{/unless}} + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +{{#each content}} +{{#if @first}} + content={ +{{/if}} + '{{{@key}}}': api_client.MediaType( + {{#if this.schema}} + {{#with this.schema}} + schema=BodySchemas.{{#if nameInSnakeCase}}{{name}}{{else}}{{baseName}}{{/if}}, + {{/with}} + {{/if}} + ), +{{#if @last}} + }, +{{/if}} +{{/each}} +{{#if responseHeaders}} + headers=Header.parameters +{{/if}} +) +{{/with}} \ No newline at end of file diff --git a/modules/openapi-json-schema-generator/src/test/java/org/openapitools/codegen/DefaultCodegenTest.java b/modules/openapi-json-schema-generator/src/test/java/org/openapitools/codegen/DefaultCodegenTest.java index cfdc60aa0aa..33eacd135ca 100644 --- a/modules/openapi-json-schema-generator/src/test/java/org/openapitools/codegen/DefaultCodegenTest.java +++ b/modules/openapi-json-schema-generator/src/test/java/org/openapitools/codegen/DefaultCodegenTest.java @@ -66,7 +66,7 @@ public void testDeeplyNestedAdditionalPropertiesImports() { codegen.setOpenAPI(openApi); PathItem path = openApi.getPaths().get("/ping"); CodegenOperation operation = codegen.fromOperation("/ping", "post", path.getPost(), path.getServers()); - Assert.assertEquals(Sets.intersection(operation.imports, Sets.newHashSet("Person")).size(), 1); + Assert.assertEquals(Sets.intersection(operation.responses.get(0).imports, Sets.newHashSet("Person")).size(), 1); } @Test @@ -4031,11 +4031,10 @@ public void testRequestParameterContent() { CodegenMediaType mt = content.get("application/json"); assertNull(mt.getEncoding()); CodegenProperty cp = mt.getSchema(); - // TODO need to revise the test below assertTrue(cp.isMap); assertTrue(cp.isModel); assertEquals(cp.complexType, "object"); - assertEquals(cp.baseName, "SchemaForRequestParameterCoordinatesInlineSchemaApplicationJson"); + assertEquals(cp.baseName, "coordinatesInlineSchema"); CodegenParameter coordinatesReferencedSchema = co.queryParams.get(1); content = coordinatesReferencedSchema.getContent(); @@ -4044,7 +4043,7 @@ public void testRequestParameterContent() { cp = mt.getSchema(); assertFalse(cp.isMap); // because it is a referenced schema assertEquals(cp.complexType, "coordinates"); - assertEquals(cp.baseName, "SchemaForRequestParameterCoordinatesReferencedSchemaApplicationJson"); + assertEquals(cp.baseName, "coordinatesReferencedSchema"); } @Test @@ -4064,13 +4063,13 @@ public void testRequestBodyContent() { CodegenMediaType mt = content.get("application/json"); assertNull(mt.getEncoding()); CodegenProperty cp = mt.getSchema(); - assertEquals(cp.baseName, "SchemaForRequestBodyApplicationJson"); + assertEquals(cp.baseName, "application/json"); assertNotNull(cp); mt = content.get("text/plain"); assertNull(mt.getEncoding()); cp = mt.getSchema(); - assertEquals(cp.baseName, "SchemaForRequestBodyTextPlain"); + assertEquals(cp.baseName, "text/plain"); assertNotNull(cp); // Note: the inline model resolver has a bug for this use case; it extracts an inline request body into a component // but the schema it references is not string type @@ -4084,13 +4083,13 @@ public void testRequestBodyContent() { mt = content.get("application/json"); assertNull(mt.getEncoding()); cp = mt.getSchema(); - assertEquals(cp.baseName, "SchemaForRequestBodyApplicationJson"); + assertEquals(cp.baseName, "application/json"); assertEquals(cp.complexType, "coordinates"); mt = content.get("text/plain"); assertNull(mt.getEncoding()); cp = mt.getSchema(); - assertEquals(cp.baseName, "SchemaForRequestBodyTextPlain"); + assertEquals(cp.baseName, "text/plain"); assertTrue(cp.isString); path = "/requestBodyWithEncodingTypes"; @@ -4171,12 +4170,12 @@ public void testResponseContentAndHeader() { CodegenProperty cp = mt.getSchema(); assertFalse(cp.isMap); // because it is a referenced schema assertEquals(cp.complexType, "coordinates"); - assertEquals(cp.baseName, "SchemaFor200ResponseBodyApplicationJson"); + assertEquals(cp.baseName, "application/json"); mt = content.get("text/plain"); assertNull(mt.getEncoding()); cp = mt.getSchema(); - assertEquals(cp.baseName, "SchemaFor200ResponseBodyTextPlain"); + assertEquals(cp.baseName, "text/plain"); assertTrue(cp.isString); cr = co.responses.get(1); @@ -4187,12 +4186,12 @@ public void testResponseContentAndHeader() { cp = mt.getSchema(); assertFalse(cp.isMap); // because it is a referenced schema assertEquals(cp.complexType, "coordinates"); - assertEquals(cp.baseName, "SchemaFor201ResponseBodyApplicationJson"); + assertEquals(cp.baseName, "application/json"); mt = content.get("text/plain"); assertNull(mt.getEncoding()); cp = mt.getSchema(); - assertEquals(cp.baseName, "SchemaFor201ResponseBodyTextPlain"); + assertEquals(cp.baseName, "text/plain"); assertTrue(cp.isString); } diff --git a/samples/openapi3/client/3_0_3_unit_test/python/.openapi-generator/FILES b/samples/openapi3/client/3_0_3_unit_test/python/.openapi-generator/FILES index 76fb1cb914d..ef95945f68f 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/.openapi-generator/FILES +++ b/samples/openapi3/client/3_0_3_unit_test/python/.openapi-generator/FILES @@ -88,6 +88,7 @@ docs/models/NulCharactersInStrings.md docs/models/NullTypeMatchesOnlyTheNullObject.md docs/models/NumberTypeMatchesNumbers.md docs/models/ObjectPropertiesValidation.md +docs/models/ObjectTypeMatchesObjects.md docs/models/Oneof.md docs/models/OneofComplexTypes.md docs/models/OneofWithBaseSchema.md @@ -181,6 +182,7 @@ test/test_models/test_nul_characters_in_strings.py test/test_models/test_null_type_matches_only_the_null_object.py test/test_models/test_number_type_matches_numbers.py test/test_models/test_object_properties_validation.py +test/test_models/test_object_type_matches_objects.py test/test_models/test_oneof.py test/test_models/test_oneof_complex_types.py test/test_models/test_oneof_with_base_schema.py @@ -360,6 +362,8 @@ unit_test_api/model/number_type_matches_numbers.py unit_test_api/model/number_type_matches_numbers.pyi unit_test_api/model/object_properties_validation.py unit_test_api/model/object_properties_validation.pyi +unit_test_api/model/object_type_matches_objects.py +unit_test_api/model/object_type_matches_objects.pyi unit_test_api/model/oneof.py unit_test_api/model/oneof.pyi unit_test_api/model/oneof_complex_types.py diff --git a/samples/openapi3/client/3_0_3_unit_test/python/README.md b/samples/openapi3/client/3_0_3_unit_test/python/README.md index 3c71a079b1b..4f59780c066 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/README.md +++ b/samples/openapi3/client/3_0_3_unit_test/python/README.md @@ -146,6 +146,7 @@ from unit_test_api.model.ref_in_additionalproperties import RefInAdditionalprope from unit_test_api.model.ref_in_allof import RefInAllof from unit_test_api.model.ref_in_anyof import RefInAnyof from unit_test_api.model.ref_in_items import RefInItems +from unit_test_api.model.ref_in_not import RefInNot from unit_test_api.model.ref_in_oneof import RefInOneof from unit_test_api.model.ref_in_property import RefInProperty # Defining the host is optional and defaults to https://someserver.com/v1 @@ -930,6 +931,7 @@ Class | Method | HTTP request | Description - [NullTypeMatchesOnlyTheNullObject](docs/models/NullTypeMatchesOnlyTheNullObject.md) - [NumberTypeMatchesNumbers](docs/models/NumberTypeMatchesNumbers.md) - [ObjectPropertiesValidation](docs/models/ObjectPropertiesValidation.md) + - [ObjectTypeMatchesObjects](docs/models/ObjectTypeMatchesObjects.md) - [Oneof](docs/models/Oneof.md) - [OneofComplexTypes](docs/models/OneofComplexTypes.md) - [OneofWithBaseSchema](docs/models/OneofWithBaseSchema.md) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/AdditionalPropertiesApi.md b/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/AdditionalPropertiesApi.md index 6b758ccf2b8..e0276631c63 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/AdditionalPropertiesApi.md +++ b/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/AdditionalPropertiesApi.md @@ -16,8 +16,6 @@ Method | HTTP request | Description # **post_additionalproperties_allows_a_schema_which_should_validate_request_body** -> post_additionalproperties_allows_a_schema_which_should_validate_request_body(additionalproperties_allows_a_schema_which_should_validate) - ### Example @@ -54,15 +52,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_additionalproperties_allows_a_schema_which_should_validate_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_additionalproperties_allows_a_schema_which_should_validate_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AdditionalpropertiesAllowsASchemaWhichShouldValidate**](../../models/AdditionalpropertiesAllowsASchemaWhichShouldValidate.md) | | @@ -73,9 +71,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_additionalproperties_allows_a_schema_which_should_validate_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_additionalproperties_allows_a_schema_which_should_validate_request_body.response_for_200.ApiResponse) | success -#### post_additionalproperties_allows_a_schema_which_should_validate_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -90,8 +88,6 @@ No authorization required # **post_additionalproperties_allows_a_schema_which_should_validate_response_body_for_content_types** -> AdditionalpropertiesAllowsASchemaWhichShouldValidate post_additionalproperties_allows_a_schema_which_should_validate_response_body_for_content_types() - ### Example @@ -99,7 +95,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import additional_properties_api -from unit_test_api.model.additionalproperties_allows_a_schema_which_should_validate import AdditionalpropertiesAllowsASchemaWhichShouldValidate from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -127,16 +122,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_additionalproperties_allows_a_schema_which_should_validate_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_additionalproperties_allows_a_schema_which_should_validate_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_additionalproperties_allows_a_schema_which_should_validate_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_additionalproperties_allows_a_schema_which_should_validate_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AdditionalpropertiesAllowsASchemaWhichShouldValidate**](../../models/AdditionalpropertiesAllowsASchemaWhichShouldValidate.md) | | @@ -150,8 +145,6 @@ No authorization required # **post_additionalproperties_are_allowed_by_default_request_body** -> post_additionalproperties_are_allowed_by_default_request_body(additionalproperties_are_allowed_by_default) - ### Example @@ -185,15 +178,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_additionalproperties_are_allowed_by_default_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_additionalproperties_are_allowed_by_default_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AdditionalpropertiesAreAllowedByDefault**](../../models/AdditionalpropertiesAreAllowedByDefault.md) | | @@ -204,9 +197,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_additionalproperties_are_allowed_by_default_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_additionalproperties_are_allowed_by_default_request_body.response_for_200.ApiResponse) | success -#### post_additionalproperties_are_allowed_by_default_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -221,8 +214,6 @@ No authorization required # **post_additionalproperties_are_allowed_by_default_response_body_for_content_types** -> AdditionalpropertiesAreAllowedByDefault post_additionalproperties_are_allowed_by_default_response_body_for_content_types() - ### Example @@ -230,7 +221,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import additional_properties_api -from unit_test_api.model.additionalproperties_are_allowed_by_default import AdditionalpropertiesAreAllowedByDefault from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -258,16 +248,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_additionalproperties_are_allowed_by_default_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_additionalproperties_are_allowed_by_default_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_additionalproperties_are_allowed_by_default_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_additionalproperties_are_allowed_by_default_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AdditionalpropertiesAreAllowedByDefault**](../../models/AdditionalpropertiesAreAllowedByDefault.md) | | @@ -281,8 +271,6 @@ No authorization required # **post_additionalproperties_can_exist_by_itself_request_body** -> post_additionalproperties_can_exist_by_itself_request_body(additionalproperties_can_exist_by_itself) - ### Example @@ -318,15 +306,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_additionalproperties_can_exist_by_itself_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_additionalproperties_can_exist_by_itself_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AdditionalpropertiesCanExistByItself**](../../models/AdditionalpropertiesCanExistByItself.md) | | @@ -337,9 +325,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_additionalproperties_can_exist_by_itself_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_additionalproperties_can_exist_by_itself_request_body.response_for_200.ApiResponse) | success -#### post_additionalproperties_can_exist_by_itself_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -354,8 +342,6 @@ No authorization required # **post_additionalproperties_can_exist_by_itself_response_body_for_content_types** -> AdditionalpropertiesCanExistByItself post_additionalproperties_can_exist_by_itself_response_body_for_content_types() - ### Example @@ -363,7 +349,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import additional_properties_api -from unit_test_api.model.additionalproperties_can_exist_by_itself import AdditionalpropertiesCanExistByItself from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -391,16 +376,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_additionalproperties_can_exist_by_itself_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_additionalproperties_can_exist_by_itself_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_additionalproperties_can_exist_by_itself_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_additionalproperties_can_exist_by_itself_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AdditionalpropertiesCanExistByItself**](../../models/AdditionalpropertiesCanExistByItself.md) | | @@ -414,8 +399,6 @@ No authorization required # **post_additionalproperties_should_not_look_in_applicators_request_body** -> post_additionalproperties_should_not_look_in_applicators_request_body(additionalproperties_should_not_look_in_applicators) - ### Example @@ -449,15 +432,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_additionalproperties_should_not_look_in_applicators_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_additionalproperties_should_not_look_in_applicators_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AdditionalpropertiesShouldNotLookInApplicators**](../../models/AdditionalpropertiesShouldNotLookInApplicators.md) | | @@ -468,9 +451,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_additionalproperties_should_not_look_in_applicators_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_additionalproperties_should_not_look_in_applicators_request_body.response_for_200.ApiResponse) | success -#### post_additionalproperties_should_not_look_in_applicators_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -485,8 +468,6 @@ No authorization required # **post_additionalproperties_should_not_look_in_applicators_response_body_for_content_types** -> AdditionalpropertiesShouldNotLookInApplicators post_additionalproperties_should_not_look_in_applicators_response_body_for_content_types() - ### Example @@ -494,7 +475,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import additional_properties_api -from unit_test_api.model.additionalproperties_should_not_look_in_applicators import AdditionalpropertiesShouldNotLookInApplicators from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -522,16 +502,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_additionalproperties_should_not_look_in_applicators_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_additionalproperties_should_not_look_in_applicators_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_additionalproperties_should_not_look_in_applicators_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_additionalproperties_should_not_look_in_applicators_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AdditionalpropertiesShouldNotLookInApplicators**](../../models/AdditionalpropertiesShouldNotLookInApplicators.md) | | diff --git a/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/AllOfApi.md b/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/AllOfApi.md index 16996cfc810..feddca2d676 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/AllOfApi.md +++ b/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/AllOfApi.md @@ -26,8 +26,6 @@ Method | HTTP request | Description # **post_allof_combined_with_anyof_oneof_request_body** -> post_allof_combined_with_anyof_oneof_request_body(allof_combined_with_anyof_oneof) - ### Example @@ -61,15 +59,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_allof_combined_with_anyof_oneof_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_allof_combined_with_anyof_oneof_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AllofCombinedWithAnyofOneof**](../../models/AllofCombinedWithAnyofOneof.md) | | @@ -80,9 +78,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_allof_combined_with_anyof_oneof_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_allof_combined_with_anyof_oneof_request_body.response_for_200.ApiResponse) | success -#### post_allof_combined_with_anyof_oneof_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -97,8 +95,6 @@ No authorization required # **post_allof_combined_with_anyof_oneof_response_body_for_content_types** -> AllofCombinedWithAnyofOneof post_allof_combined_with_anyof_oneof_response_body_for_content_types() - ### Example @@ -106,7 +102,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import all_of_api -from unit_test_api.model.allof_combined_with_anyof_oneof import AllofCombinedWithAnyofOneof from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -134,16 +129,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_allof_combined_with_anyof_oneof_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_allof_combined_with_anyof_oneof_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_allof_combined_with_anyof_oneof_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_allof_combined_with_anyof_oneof_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AllofCombinedWithAnyofOneof**](../../models/AllofCombinedWithAnyofOneof.md) | | @@ -157,8 +152,6 @@ No authorization required # **post_allof_request_body** -> post_allof_request_body(allof) - ### Example @@ -192,15 +185,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_allof_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_allof_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**Allof**](../../models/Allof.md) | | @@ -211,9 +204,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_allof_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_allof_request_body.response_for_200.ApiResponse) | success -#### post_allof_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -228,8 +221,6 @@ No authorization required # **post_allof_response_body_for_content_types** -> Allof post_allof_response_body_for_content_types() - ### Example @@ -237,7 +228,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import all_of_api -from unit_test_api.model.allof import Allof from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -265,16 +255,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_allof_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_allof_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_allof_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_allof_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**Allof**](../../models/Allof.md) | | @@ -288,8 +278,6 @@ No authorization required # **post_allof_simple_types_request_body** -> post_allof_simple_types_request_body(allof_simple_types) - ### Example @@ -323,15 +311,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_allof_simple_types_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_allof_simple_types_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AllofSimpleTypes**](../../models/AllofSimpleTypes.md) | | @@ -342,9 +330,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_allof_simple_types_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_allof_simple_types_request_body.response_for_200.ApiResponse) | success -#### post_allof_simple_types_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -359,8 +347,6 @@ No authorization required # **post_allof_simple_types_response_body_for_content_types** -> AllofSimpleTypes post_allof_simple_types_response_body_for_content_types() - ### Example @@ -368,7 +354,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import all_of_api -from unit_test_api.model.allof_simple_types import AllofSimpleTypes from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -396,16 +381,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_allof_simple_types_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_allof_simple_types_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_allof_simple_types_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_allof_simple_types_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AllofSimpleTypes**](../../models/AllofSimpleTypes.md) | | @@ -419,8 +404,6 @@ No authorization required # **post_allof_with_base_schema_request_body** -> post_allof_with_base_schema_request_body(allof_with_base_schema) - ### Example @@ -454,15 +437,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_allof_with_base_schema_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_allof_with_base_schema_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AllofWithBaseSchema**](../../models/AllofWithBaseSchema.md) | | @@ -473,9 +456,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_allof_with_base_schema_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_allof_with_base_schema_request_body.response_for_200.ApiResponse) | success -#### post_allof_with_base_schema_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -490,8 +473,6 @@ No authorization required # **post_allof_with_base_schema_response_body_for_content_types** -> AllofWithBaseSchema post_allof_with_base_schema_response_body_for_content_types() - ### Example @@ -499,7 +480,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import all_of_api -from unit_test_api.model.allof_with_base_schema import AllofWithBaseSchema from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -527,16 +507,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_allof_with_base_schema_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_allof_with_base_schema_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_allof_with_base_schema_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_allof_with_base_schema_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AllofWithBaseSchema**](../../models/AllofWithBaseSchema.md) | | @@ -550,8 +530,6 @@ No authorization required # **post_allof_with_one_empty_schema_request_body** -> post_allof_with_one_empty_schema_request_body(allof_with_one_empty_schema) - ### Example @@ -585,15 +563,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_allof_with_one_empty_schema_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_allof_with_one_empty_schema_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AllofWithOneEmptySchema**](../../models/AllofWithOneEmptySchema.md) | | @@ -604,9 +582,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_allof_with_one_empty_schema_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_allof_with_one_empty_schema_request_body.response_for_200.ApiResponse) | success -#### post_allof_with_one_empty_schema_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -621,8 +599,6 @@ No authorization required # **post_allof_with_one_empty_schema_response_body_for_content_types** -> AllofWithOneEmptySchema post_allof_with_one_empty_schema_response_body_for_content_types() - ### Example @@ -630,7 +606,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import all_of_api -from unit_test_api.model.allof_with_one_empty_schema import AllofWithOneEmptySchema from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -658,16 +633,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_allof_with_one_empty_schema_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_allof_with_one_empty_schema_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_allof_with_one_empty_schema_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_allof_with_one_empty_schema_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AllofWithOneEmptySchema**](../../models/AllofWithOneEmptySchema.md) | | @@ -681,8 +656,6 @@ No authorization required # **post_allof_with_the_first_empty_schema_request_body** -> post_allof_with_the_first_empty_schema_request_body(allof_with_the_first_empty_schema) - ### Example @@ -716,15 +689,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_allof_with_the_first_empty_schema_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_allof_with_the_first_empty_schema_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AllofWithTheFirstEmptySchema**](../../models/AllofWithTheFirstEmptySchema.md) | | @@ -735,9 +708,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_allof_with_the_first_empty_schema_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_allof_with_the_first_empty_schema_request_body.response_for_200.ApiResponse) | success -#### post_allof_with_the_first_empty_schema_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -752,8 +725,6 @@ No authorization required # **post_allof_with_the_first_empty_schema_response_body_for_content_types** -> AllofWithTheFirstEmptySchema post_allof_with_the_first_empty_schema_response_body_for_content_types() - ### Example @@ -761,7 +732,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import all_of_api -from unit_test_api.model.allof_with_the_first_empty_schema import AllofWithTheFirstEmptySchema from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -789,16 +759,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_allof_with_the_first_empty_schema_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_allof_with_the_first_empty_schema_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_allof_with_the_first_empty_schema_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_allof_with_the_first_empty_schema_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AllofWithTheFirstEmptySchema**](../../models/AllofWithTheFirstEmptySchema.md) | | @@ -812,8 +782,6 @@ No authorization required # **post_allof_with_the_last_empty_schema_request_body** -> post_allof_with_the_last_empty_schema_request_body(allof_with_the_last_empty_schema) - ### Example @@ -847,15 +815,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_allof_with_the_last_empty_schema_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_allof_with_the_last_empty_schema_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AllofWithTheLastEmptySchema**](../../models/AllofWithTheLastEmptySchema.md) | | @@ -866,9 +834,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_allof_with_the_last_empty_schema_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_allof_with_the_last_empty_schema_request_body.response_for_200.ApiResponse) | success -#### post_allof_with_the_last_empty_schema_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -883,8 +851,6 @@ No authorization required # **post_allof_with_the_last_empty_schema_response_body_for_content_types** -> AllofWithTheLastEmptySchema post_allof_with_the_last_empty_schema_response_body_for_content_types() - ### Example @@ -892,7 +858,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import all_of_api -from unit_test_api.model.allof_with_the_last_empty_schema import AllofWithTheLastEmptySchema from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -920,16 +885,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_allof_with_the_last_empty_schema_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_allof_with_the_last_empty_schema_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_allof_with_the_last_empty_schema_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_allof_with_the_last_empty_schema_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AllofWithTheLastEmptySchema**](../../models/AllofWithTheLastEmptySchema.md) | | @@ -943,8 +908,6 @@ No authorization required # **post_allof_with_two_empty_schemas_request_body** -> post_allof_with_two_empty_schemas_request_body(allof_with_two_empty_schemas) - ### Example @@ -978,15 +941,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_allof_with_two_empty_schemas_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_allof_with_two_empty_schemas_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AllofWithTwoEmptySchemas**](../../models/AllofWithTwoEmptySchemas.md) | | @@ -997,9 +960,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_allof_with_two_empty_schemas_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_allof_with_two_empty_schemas_request_body.response_for_200.ApiResponse) | success -#### post_allof_with_two_empty_schemas_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -1014,8 +977,6 @@ No authorization required # **post_allof_with_two_empty_schemas_response_body_for_content_types** -> AllofWithTwoEmptySchemas post_allof_with_two_empty_schemas_response_body_for_content_types() - ### Example @@ -1023,7 +984,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import all_of_api -from unit_test_api.model.allof_with_two_empty_schemas import AllofWithTwoEmptySchemas from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -1051,16 +1011,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_allof_with_two_empty_schemas_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_allof_with_two_empty_schemas_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_allof_with_two_empty_schemas_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_allof_with_two_empty_schemas_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AllofWithTwoEmptySchemas**](../../models/AllofWithTwoEmptySchemas.md) | | @@ -1074,8 +1034,6 @@ No authorization required # **post_nested_allof_to_check_validation_semantics_request_body** -> post_nested_allof_to_check_validation_semantics_request_body(nested_allof_to_check_validation_semantics) - ### Example @@ -1109,15 +1067,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_nested_allof_to_check_validation_semantics_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_nested_allof_to_check_validation_semantics_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**NestedAllofToCheckValidationSemantics**](../../models/NestedAllofToCheckValidationSemantics.md) | | @@ -1128,9 +1086,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_nested_allof_to_check_validation_semantics_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_nested_allof_to_check_validation_semantics_request_body.response_for_200.ApiResponse) | success -#### post_nested_allof_to_check_validation_semantics_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -1145,8 +1103,6 @@ No authorization required # **post_nested_allof_to_check_validation_semantics_response_body_for_content_types** -> NestedAllofToCheckValidationSemantics post_nested_allof_to_check_validation_semantics_response_body_for_content_types() - ### Example @@ -1154,7 +1110,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import all_of_api -from unit_test_api.model.nested_allof_to_check_validation_semantics import NestedAllofToCheckValidationSemantics from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -1182,16 +1137,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_nested_allof_to_check_validation_semantics_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_nested_allof_to_check_validation_semantics_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_nested_allof_to_check_validation_semantics_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_nested_allof_to_check_validation_semantics_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**NestedAllofToCheckValidationSemantics**](../../models/NestedAllofToCheckValidationSemantics.md) | | diff --git a/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/AnyOfApi.md b/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/AnyOfApi.md index 8f0a035a810..efcd9a6953f 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/AnyOfApi.md +++ b/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/AnyOfApi.md @@ -18,8 +18,6 @@ Method | HTTP request | Description # **post_anyof_complex_types_request_body** -> post_anyof_complex_types_request_body(anyof_complex_types) - ### Example @@ -53,15 +51,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_anyof_complex_types_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_anyof_complex_types_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AnyofComplexTypes**](../../models/AnyofComplexTypes.md) | | @@ -72,9 +70,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_anyof_complex_types_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_anyof_complex_types_request_body.response_for_200.ApiResponse) | success -#### post_anyof_complex_types_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -89,8 +87,6 @@ No authorization required # **post_anyof_complex_types_response_body_for_content_types** -> AnyofComplexTypes post_anyof_complex_types_response_body_for_content_types() - ### Example @@ -98,7 +94,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import any_of_api -from unit_test_api.model.anyof_complex_types import AnyofComplexTypes from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -126,16 +121,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_anyof_complex_types_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_anyof_complex_types_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_anyof_complex_types_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_anyof_complex_types_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AnyofComplexTypes**](../../models/AnyofComplexTypes.md) | | @@ -149,8 +144,6 @@ No authorization required # **post_anyof_request_body** -> post_anyof_request_body(anyof) - ### Example @@ -184,15 +177,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_anyof_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_anyof_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**Anyof**](../../models/Anyof.md) | | @@ -203,9 +196,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_anyof_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_anyof_request_body.response_for_200.ApiResponse) | success -#### post_anyof_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -220,8 +213,6 @@ No authorization required # **post_anyof_response_body_for_content_types** -> Anyof post_anyof_response_body_for_content_types() - ### Example @@ -229,7 +220,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import any_of_api -from unit_test_api.model.anyof import Anyof from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -257,16 +247,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_anyof_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_anyof_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_anyof_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_anyof_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**Anyof**](../../models/Anyof.md) | | @@ -280,8 +270,6 @@ No authorization required # **post_anyof_with_base_schema_request_body** -> post_anyof_with_base_schema_request_body(body) - ### Example @@ -315,15 +303,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_anyof_with_base_schema_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_anyof_with_base_schema_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AnyofWithBaseSchema**](../../models/AnyofWithBaseSchema.md) | | @@ -334,9 +322,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_anyof_with_base_schema_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_anyof_with_base_schema_request_body.response_for_200.ApiResponse) | success -#### post_anyof_with_base_schema_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -351,8 +339,6 @@ No authorization required # **post_anyof_with_base_schema_response_body_for_content_types** -> AnyofWithBaseSchema post_anyof_with_base_schema_response_body_for_content_types() - ### Example @@ -360,7 +346,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import any_of_api -from unit_test_api.model.anyof_with_base_schema import AnyofWithBaseSchema from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -388,16 +373,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_anyof_with_base_schema_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_anyof_with_base_schema_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_anyof_with_base_schema_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_anyof_with_base_schema_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AnyofWithBaseSchema**](../../models/AnyofWithBaseSchema.md) | | @@ -411,8 +396,6 @@ No authorization required # **post_anyof_with_one_empty_schema_request_body** -> post_anyof_with_one_empty_schema_request_body(anyof_with_one_empty_schema) - ### Example @@ -446,15 +429,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_anyof_with_one_empty_schema_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_anyof_with_one_empty_schema_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AnyofWithOneEmptySchema**](../../models/AnyofWithOneEmptySchema.md) | | @@ -465,9 +448,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_anyof_with_one_empty_schema_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_anyof_with_one_empty_schema_request_body.response_for_200.ApiResponse) | success -#### post_anyof_with_one_empty_schema_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -482,8 +465,6 @@ No authorization required # **post_anyof_with_one_empty_schema_response_body_for_content_types** -> AnyofWithOneEmptySchema post_anyof_with_one_empty_schema_response_body_for_content_types() - ### Example @@ -491,7 +472,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import any_of_api -from unit_test_api.model.anyof_with_one_empty_schema import AnyofWithOneEmptySchema from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -519,16 +499,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_anyof_with_one_empty_schema_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_anyof_with_one_empty_schema_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_anyof_with_one_empty_schema_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_anyof_with_one_empty_schema_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AnyofWithOneEmptySchema**](../../models/AnyofWithOneEmptySchema.md) | | @@ -542,8 +522,6 @@ No authorization required # **post_nested_anyof_to_check_validation_semantics_request_body** -> post_nested_anyof_to_check_validation_semantics_request_body(nested_anyof_to_check_validation_semantics) - ### Example @@ -577,15 +555,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_nested_anyof_to_check_validation_semantics_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_nested_anyof_to_check_validation_semantics_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**NestedAnyofToCheckValidationSemantics**](../../models/NestedAnyofToCheckValidationSemantics.md) | | @@ -596,9 +574,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_nested_anyof_to_check_validation_semantics_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_nested_anyof_to_check_validation_semantics_request_body.response_for_200.ApiResponse) | success -#### post_nested_anyof_to_check_validation_semantics_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -613,8 +591,6 @@ No authorization required # **post_nested_anyof_to_check_validation_semantics_response_body_for_content_types** -> NestedAnyofToCheckValidationSemantics post_nested_anyof_to_check_validation_semantics_response_body_for_content_types() - ### Example @@ -622,7 +598,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import any_of_api -from unit_test_api.model.nested_anyof_to_check_validation_semantics import NestedAnyofToCheckValidationSemantics from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -650,16 +625,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_nested_anyof_to_check_validation_semantics_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_nested_anyof_to_check_validation_semantics_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_nested_anyof_to_check_validation_semantics_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_nested_anyof_to_check_validation_semantics_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**NestedAnyofToCheckValidationSemantics**](../../models/NestedAnyofToCheckValidationSemantics.md) | | diff --git a/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/ContentTypeJsonApi.md b/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/ContentTypeJsonApi.md index 0a1a6bd184c..9b6065023bc 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/ContentTypeJsonApi.md +++ b/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/ContentTypeJsonApi.md @@ -182,8 +182,6 @@ Method | HTTP request | Description # **post_additionalproperties_allows_a_schema_which_should_validate_request_body** -> post_additionalproperties_allows_a_schema_which_should_validate_request_body(additionalproperties_allows_a_schema_which_should_validate) - ### Example @@ -220,15 +218,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_additionalproperties_allows_a_schema_which_should_validate_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_additionalproperties_allows_a_schema_which_should_validate_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AdditionalpropertiesAllowsASchemaWhichShouldValidate**](../../models/AdditionalpropertiesAllowsASchemaWhichShouldValidate.md) | | @@ -239,9 +237,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_additionalproperties_allows_a_schema_which_should_validate_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_additionalproperties_allows_a_schema_which_should_validate_request_body.response_for_200.ApiResponse) | success -#### post_additionalproperties_allows_a_schema_which_should_validate_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -256,8 +254,6 @@ No authorization required # **post_additionalproperties_allows_a_schema_which_should_validate_response_body_for_content_types** -> AdditionalpropertiesAllowsASchemaWhichShouldValidate post_additionalproperties_allows_a_schema_which_should_validate_response_body_for_content_types() - ### Example @@ -265,7 +261,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import content_type_json_api -from unit_test_api.model.additionalproperties_allows_a_schema_which_should_validate import AdditionalpropertiesAllowsASchemaWhichShouldValidate from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -293,16 +288,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_additionalproperties_allows_a_schema_which_should_validate_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_additionalproperties_allows_a_schema_which_should_validate_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_additionalproperties_allows_a_schema_which_should_validate_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_additionalproperties_allows_a_schema_which_should_validate_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AdditionalpropertiesAllowsASchemaWhichShouldValidate**](../../models/AdditionalpropertiesAllowsASchemaWhichShouldValidate.md) | | @@ -316,8 +311,6 @@ No authorization required # **post_additionalproperties_are_allowed_by_default_request_body** -> post_additionalproperties_are_allowed_by_default_request_body(additionalproperties_are_allowed_by_default) - ### Example @@ -351,15 +344,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_additionalproperties_are_allowed_by_default_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_additionalproperties_are_allowed_by_default_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AdditionalpropertiesAreAllowedByDefault**](../../models/AdditionalpropertiesAreAllowedByDefault.md) | | @@ -370,9 +363,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_additionalproperties_are_allowed_by_default_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_additionalproperties_are_allowed_by_default_request_body.response_for_200.ApiResponse) | success -#### post_additionalproperties_are_allowed_by_default_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -387,8 +380,6 @@ No authorization required # **post_additionalproperties_are_allowed_by_default_response_body_for_content_types** -> AdditionalpropertiesAreAllowedByDefault post_additionalproperties_are_allowed_by_default_response_body_for_content_types() - ### Example @@ -396,7 +387,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import content_type_json_api -from unit_test_api.model.additionalproperties_are_allowed_by_default import AdditionalpropertiesAreAllowedByDefault from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -424,16 +414,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_additionalproperties_are_allowed_by_default_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_additionalproperties_are_allowed_by_default_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_additionalproperties_are_allowed_by_default_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_additionalproperties_are_allowed_by_default_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AdditionalpropertiesAreAllowedByDefault**](../../models/AdditionalpropertiesAreAllowedByDefault.md) | | @@ -447,8 +437,6 @@ No authorization required # **post_additionalproperties_can_exist_by_itself_request_body** -> post_additionalproperties_can_exist_by_itself_request_body(additionalproperties_can_exist_by_itself) - ### Example @@ -484,15 +472,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_additionalproperties_can_exist_by_itself_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_additionalproperties_can_exist_by_itself_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AdditionalpropertiesCanExistByItself**](../../models/AdditionalpropertiesCanExistByItself.md) | | @@ -503,9 +491,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_additionalproperties_can_exist_by_itself_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_additionalproperties_can_exist_by_itself_request_body.response_for_200.ApiResponse) | success -#### post_additionalproperties_can_exist_by_itself_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -520,8 +508,6 @@ No authorization required # **post_additionalproperties_can_exist_by_itself_response_body_for_content_types** -> AdditionalpropertiesCanExistByItself post_additionalproperties_can_exist_by_itself_response_body_for_content_types() - ### Example @@ -529,7 +515,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import content_type_json_api -from unit_test_api.model.additionalproperties_can_exist_by_itself import AdditionalpropertiesCanExistByItself from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -557,16 +542,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_additionalproperties_can_exist_by_itself_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_additionalproperties_can_exist_by_itself_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_additionalproperties_can_exist_by_itself_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_additionalproperties_can_exist_by_itself_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AdditionalpropertiesCanExistByItself**](../../models/AdditionalpropertiesCanExistByItself.md) | | @@ -580,8 +565,6 @@ No authorization required # **post_additionalproperties_should_not_look_in_applicators_request_body** -> post_additionalproperties_should_not_look_in_applicators_request_body(additionalproperties_should_not_look_in_applicators) - ### Example @@ -615,15 +598,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_additionalproperties_should_not_look_in_applicators_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_additionalproperties_should_not_look_in_applicators_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AdditionalpropertiesShouldNotLookInApplicators**](../../models/AdditionalpropertiesShouldNotLookInApplicators.md) | | @@ -634,9 +617,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_additionalproperties_should_not_look_in_applicators_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_additionalproperties_should_not_look_in_applicators_request_body.response_for_200.ApiResponse) | success -#### post_additionalproperties_should_not_look_in_applicators_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -651,8 +634,6 @@ No authorization required # **post_additionalproperties_should_not_look_in_applicators_response_body_for_content_types** -> AdditionalpropertiesShouldNotLookInApplicators post_additionalproperties_should_not_look_in_applicators_response_body_for_content_types() - ### Example @@ -660,7 +641,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import content_type_json_api -from unit_test_api.model.additionalproperties_should_not_look_in_applicators import AdditionalpropertiesShouldNotLookInApplicators from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -688,16 +668,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_additionalproperties_should_not_look_in_applicators_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_additionalproperties_should_not_look_in_applicators_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_additionalproperties_should_not_look_in_applicators_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_additionalproperties_should_not_look_in_applicators_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AdditionalpropertiesShouldNotLookInApplicators**](../../models/AdditionalpropertiesShouldNotLookInApplicators.md) | | @@ -711,8 +691,6 @@ No authorization required # **post_allof_combined_with_anyof_oneof_request_body** -> post_allof_combined_with_anyof_oneof_request_body(allof_combined_with_anyof_oneof) - ### Example @@ -746,15 +724,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_allof_combined_with_anyof_oneof_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_allof_combined_with_anyof_oneof_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AllofCombinedWithAnyofOneof**](../../models/AllofCombinedWithAnyofOneof.md) | | @@ -765,9 +743,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_allof_combined_with_anyof_oneof_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_allof_combined_with_anyof_oneof_request_body.response_for_200.ApiResponse) | success -#### post_allof_combined_with_anyof_oneof_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -782,8 +760,6 @@ No authorization required # **post_allof_combined_with_anyof_oneof_response_body_for_content_types** -> AllofCombinedWithAnyofOneof post_allof_combined_with_anyof_oneof_response_body_for_content_types() - ### Example @@ -791,7 +767,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import content_type_json_api -from unit_test_api.model.allof_combined_with_anyof_oneof import AllofCombinedWithAnyofOneof from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -819,16 +794,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_allof_combined_with_anyof_oneof_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_allof_combined_with_anyof_oneof_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_allof_combined_with_anyof_oneof_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_allof_combined_with_anyof_oneof_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AllofCombinedWithAnyofOneof**](../../models/AllofCombinedWithAnyofOneof.md) | | @@ -842,8 +817,6 @@ No authorization required # **post_allof_request_body** -> post_allof_request_body(allof) - ### Example @@ -877,15 +850,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_allof_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_allof_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**Allof**](../../models/Allof.md) | | @@ -896,9 +869,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_allof_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_allof_request_body.response_for_200.ApiResponse) | success -#### post_allof_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -913,8 +886,6 @@ No authorization required # **post_allof_response_body_for_content_types** -> Allof post_allof_response_body_for_content_types() - ### Example @@ -922,7 +893,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import content_type_json_api -from unit_test_api.model.allof import Allof from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -950,16 +920,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_allof_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_allof_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_allof_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_allof_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**Allof**](../../models/Allof.md) | | @@ -973,8 +943,6 @@ No authorization required # **post_allof_simple_types_request_body** -> post_allof_simple_types_request_body(allof_simple_types) - ### Example @@ -1008,15 +976,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_allof_simple_types_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_allof_simple_types_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AllofSimpleTypes**](../../models/AllofSimpleTypes.md) | | @@ -1027,9 +995,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_allof_simple_types_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_allof_simple_types_request_body.response_for_200.ApiResponse) | success -#### post_allof_simple_types_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -1044,8 +1012,6 @@ No authorization required # **post_allof_simple_types_response_body_for_content_types** -> AllofSimpleTypes post_allof_simple_types_response_body_for_content_types() - ### Example @@ -1053,7 +1019,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import content_type_json_api -from unit_test_api.model.allof_simple_types import AllofSimpleTypes from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -1081,16 +1046,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_allof_simple_types_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_allof_simple_types_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_allof_simple_types_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_allof_simple_types_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AllofSimpleTypes**](../../models/AllofSimpleTypes.md) | | @@ -1104,8 +1069,6 @@ No authorization required # **post_allof_with_base_schema_request_body** -> post_allof_with_base_schema_request_body(allof_with_base_schema) - ### Example @@ -1139,15 +1102,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_allof_with_base_schema_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_allof_with_base_schema_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AllofWithBaseSchema**](../../models/AllofWithBaseSchema.md) | | @@ -1158,9 +1121,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_allof_with_base_schema_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_allof_with_base_schema_request_body.response_for_200.ApiResponse) | success -#### post_allof_with_base_schema_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -1175,8 +1138,6 @@ No authorization required # **post_allof_with_base_schema_response_body_for_content_types** -> AllofWithBaseSchema post_allof_with_base_schema_response_body_for_content_types() - ### Example @@ -1184,7 +1145,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import content_type_json_api -from unit_test_api.model.allof_with_base_schema import AllofWithBaseSchema from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -1212,16 +1172,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_allof_with_base_schema_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_allof_with_base_schema_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_allof_with_base_schema_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_allof_with_base_schema_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AllofWithBaseSchema**](../../models/AllofWithBaseSchema.md) | | @@ -1235,8 +1195,6 @@ No authorization required # **post_allof_with_one_empty_schema_request_body** -> post_allof_with_one_empty_schema_request_body(allof_with_one_empty_schema) - ### Example @@ -1270,15 +1228,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_allof_with_one_empty_schema_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_allof_with_one_empty_schema_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AllofWithOneEmptySchema**](../../models/AllofWithOneEmptySchema.md) | | @@ -1289,9 +1247,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_allof_with_one_empty_schema_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_allof_with_one_empty_schema_request_body.response_for_200.ApiResponse) | success -#### post_allof_with_one_empty_schema_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -1306,8 +1264,6 @@ No authorization required # **post_allof_with_one_empty_schema_response_body_for_content_types** -> AllofWithOneEmptySchema post_allof_with_one_empty_schema_response_body_for_content_types() - ### Example @@ -1315,7 +1271,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import content_type_json_api -from unit_test_api.model.allof_with_one_empty_schema import AllofWithOneEmptySchema from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -1343,16 +1298,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_allof_with_one_empty_schema_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_allof_with_one_empty_schema_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_allof_with_one_empty_schema_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_allof_with_one_empty_schema_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AllofWithOneEmptySchema**](../../models/AllofWithOneEmptySchema.md) | | @@ -1366,8 +1321,6 @@ No authorization required # **post_allof_with_the_first_empty_schema_request_body** -> post_allof_with_the_first_empty_schema_request_body(allof_with_the_first_empty_schema) - ### Example @@ -1401,15 +1354,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_allof_with_the_first_empty_schema_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_allof_with_the_first_empty_schema_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AllofWithTheFirstEmptySchema**](../../models/AllofWithTheFirstEmptySchema.md) | | @@ -1420,9 +1373,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_allof_with_the_first_empty_schema_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_allof_with_the_first_empty_schema_request_body.response_for_200.ApiResponse) | success -#### post_allof_with_the_first_empty_schema_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -1437,8 +1390,6 @@ No authorization required # **post_allof_with_the_first_empty_schema_response_body_for_content_types** -> AllofWithTheFirstEmptySchema post_allof_with_the_first_empty_schema_response_body_for_content_types() - ### Example @@ -1446,7 +1397,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import content_type_json_api -from unit_test_api.model.allof_with_the_first_empty_schema import AllofWithTheFirstEmptySchema from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -1474,16 +1424,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_allof_with_the_first_empty_schema_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_allof_with_the_first_empty_schema_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_allof_with_the_first_empty_schema_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_allof_with_the_first_empty_schema_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AllofWithTheFirstEmptySchema**](../../models/AllofWithTheFirstEmptySchema.md) | | @@ -1497,8 +1447,6 @@ No authorization required # **post_allof_with_the_last_empty_schema_request_body** -> post_allof_with_the_last_empty_schema_request_body(allof_with_the_last_empty_schema) - ### Example @@ -1532,15 +1480,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_allof_with_the_last_empty_schema_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_allof_with_the_last_empty_schema_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AllofWithTheLastEmptySchema**](../../models/AllofWithTheLastEmptySchema.md) | | @@ -1551,9 +1499,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_allof_with_the_last_empty_schema_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_allof_with_the_last_empty_schema_request_body.response_for_200.ApiResponse) | success -#### post_allof_with_the_last_empty_schema_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -1568,8 +1516,6 @@ No authorization required # **post_allof_with_the_last_empty_schema_response_body_for_content_types** -> AllofWithTheLastEmptySchema post_allof_with_the_last_empty_schema_response_body_for_content_types() - ### Example @@ -1577,7 +1523,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import content_type_json_api -from unit_test_api.model.allof_with_the_last_empty_schema import AllofWithTheLastEmptySchema from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -1605,16 +1550,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_allof_with_the_last_empty_schema_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_allof_with_the_last_empty_schema_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_allof_with_the_last_empty_schema_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_allof_with_the_last_empty_schema_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AllofWithTheLastEmptySchema**](../../models/AllofWithTheLastEmptySchema.md) | | @@ -1628,8 +1573,6 @@ No authorization required # **post_allof_with_two_empty_schemas_request_body** -> post_allof_with_two_empty_schemas_request_body(allof_with_two_empty_schemas) - ### Example @@ -1663,15 +1606,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_allof_with_two_empty_schemas_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_allof_with_two_empty_schemas_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AllofWithTwoEmptySchemas**](../../models/AllofWithTwoEmptySchemas.md) | | @@ -1682,9 +1625,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_allof_with_two_empty_schemas_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_allof_with_two_empty_schemas_request_body.response_for_200.ApiResponse) | success -#### post_allof_with_two_empty_schemas_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -1699,8 +1642,6 @@ No authorization required # **post_allof_with_two_empty_schemas_response_body_for_content_types** -> AllofWithTwoEmptySchemas post_allof_with_two_empty_schemas_response_body_for_content_types() - ### Example @@ -1708,7 +1649,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import content_type_json_api -from unit_test_api.model.allof_with_two_empty_schemas import AllofWithTwoEmptySchemas from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -1736,16 +1676,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_allof_with_two_empty_schemas_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_allof_with_two_empty_schemas_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_allof_with_two_empty_schemas_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_allof_with_two_empty_schemas_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AllofWithTwoEmptySchemas**](../../models/AllofWithTwoEmptySchemas.md) | | @@ -1759,8 +1699,6 @@ No authorization required # **post_anyof_complex_types_request_body** -> post_anyof_complex_types_request_body(anyof_complex_types) - ### Example @@ -1794,15 +1732,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_anyof_complex_types_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_anyof_complex_types_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AnyofComplexTypes**](../../models/AnyofComplexTypes.md) | | @@ -1813,9 +1751,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_anyof_complex_types_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_anyof_complex_types_request_body.response_for_200.ApiResponse) | success -#### post_anyof_complex_types_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -1830,8 +1768,6 @@ No authorization required # **post_anyof_complex_types_response_body_for_content_types** -> AnyofComplexTypes post_anyof_complex_types_response_body_for_content_types() - ### Example @@ -1839,7 +1775,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import content_type_json_api -from unit_test_api.model.anyof_complex_types import AnyofComplexTypes from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -1867,16 +1802,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_anyof_complex_types_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_anyof_complex_types_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_anyof_complex_types_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_anyof_complex_types_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AnyofComplexTypes**](../../models/AnyofComplexTypes.md) | | @@ -1890,8 +1825,6 @@ No authorization required # **post_anyof_request_body** -> post_anyof_request_body(anyof) - ### Example @@ -1925,15 +1858,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_anyof_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_anyof_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**Anyof**](../../models/Anyof.md) | | @@ -1944,9 +1877,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_anyof_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_anyof_request_body.response_for_200.ApiResponse) | success -#### post_anyof_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -1961,8 +1894,6 @@ No authorization required # **post_anyof_response_body_for_content_types** -> Anyof post_anyof_response_body_for_content_types() - ### Example @@ -1970,7 +1901,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import content_type_json_api -from unit_test_api.model.anyof import Anyof from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -1998,16 +1928,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_anyof_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_anyof_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_anyof_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_anyof_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**Anyof**](../../models/Anyof.md) | | @@ -2021,8 +1951,6 @@ No authorization required # **post_anyof_with_base_schema_request_body** -> post_anyof_with_base_schema_request_body(body) - ### Example @@ -2056,15 +1984,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_anyof_with_base_schema_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_anyof_with_base_schema_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AnyofWithBaseSchema**](../../models/AnyofWithBaseSchema.md) | | @@ -2075,9 +2003,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_anyof_with_base_schema_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_anyof_with_base_schema_request_body.response_for_200.ApiResponse) | success -#### post_anyof_with_base_schema_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -2092,8 +2020,6 @@ No authorization required # **post_anyof_with_base_schema_response_body_for_content_types** -> AnyofWithBaseSchema post_anyof_with_base_schema_response_body_for_content_types() - ### Example @@ -2101,7 +2027,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import content_type_json_api -from unit_test_api.model.anyof_with_base_schema import AnyofWithBaseSchema from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -2129,16 +2054,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_anyof_with_base_schema_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_anyof_with_base_schema_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_anyof_with_base_schema_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_anyof_with_base_schema_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AnyofWithBaseSchema**](../../models/AnyofWithBaseSchema.md) | | @@ -2152,8 +2077,6 @@ No authorization required # **post_anyof_with_one_empty_schema_request_body** -> post_anyof_with_one_empty_schema_request_body(anyof_with_one_empty_schema) - ### Example @@ -2187,15 +2110,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_anyof_with_one_empty_schema_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_anyof_with_one_empty_schema_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AnyofWithOneEmptySchema**](../../models/AnyofWithOneEmptySchema.md) | | @@ -2206,9 +2129,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_anyof_with_one_empty_schema_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_anyof_with_one_empty_schema_request_body.response_for_200.ApiResponse) | success -#### post_anyof_with_one_empty_schema_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -2223,8 +2146,6 @@ No authorization required # **post_anyof_with_one_empty_schema_response_body_for_content_types** -> AnyofWithOneEmptySchema post_anyof_with_one_empty_schema_response_body_for_content_types() - ### Example @@ -2232,7 +2153,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import content_type_json_api -from unit_test_api.model.anyof_with_one_empty_schema import AnyofWithOneEmptySchema from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -2260,16 +2180,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_anyof_with_one_empty_schema_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_anyof_with_one_empty_schema_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_anyof_with_one_empty_schema_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_anyof_with_one_empty_schema_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AnyofWithOneEmptySchema**](../../models/AnyofWithOneEmptySchema.md) | | @@ -2283,8 +2203,6 @@ No authorization required # **post_array_type_matches_arrays_request_body** -> post_array_type_matches_arrays_request_body(array_type_matches_arrays) - ### Example @@ -2320,15 +2238,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_array_type_matches_arrays_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_array_type_matches_arrays_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**ArrayTypeMatchesArrays**](../../models/ArrayTypeMatchesArrays.md) | | @@ -2339,9 +2257,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_array_type_matches_arrays_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_array_type_matches_arrays_request_body.response_for_200.ApiResponse) | success -#### post_array_type_matches_arrays_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -2356,8 +2274,6 @@ No authorization required # **post_array_type_matches_arrays_response_body_for_content_types** -> ArrayTypeMatchesArrays post_array_type_matches_arrays_response_body_for_content_types() - ### Example @@ -2365,7 +2281,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import content_type_json_api -from unit_test_api.model.array_type_matches_arrays import ArrayTypeMatchesArrays from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -2393,16 +2308,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_array_type_matches_arrays_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_array_type_matches_arrays_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_array_type_matches_arrays_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_array_type_matches_arrays_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**ArrayTypeMatchesArrays**](../../models/ArrayTypeMatchesArrays.md) | | @@ -2416,8 +2331,6 @@ No authorization required # **post_boolean_type_matches_booleans_request_body** -> post_boolean_type_matches_booleans_request_body(body) - ### Example @@ -2425,6 +2338,7 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import content_type_json_api +from unit_test_api.model.boolean_type_matches_booleans import BooleanTypeMatchesBooleans from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -2438,7 +2352,7 @@ with unit_test_api.ApiClient(configuration) as api_client: api_instance = content_type_json_api.ContentTypeJsonApi(api_client) # example passing only required values which don't have defaults set - body = True + body = BooleanTypeMatchesBooleans(True) try: api_response = api_instance.post_boolean_type_matches_booleans_request_body( body=body, @@ -2450,29 +2364,28 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_boolean_type_matches_booleans_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_boolean_type_matches_booleans_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**BooleanTypeMatchesBooleans**](../../models/BooleanTypeMatchesBooleans.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -bool, | BoolClass, | | ### Return Types, Responses Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_boolean_type_matches_booleans_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_boolean_type_matches_booleans_request_body.response_for_200.ApiResponse) | success -#### post_boolean_type_matches_booleans_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -2487,8 +2400,6 @@ No authorization required # **post_boolean_type_matches_booleans_response_body_for_content_types** -> bool post_boolean_type_matches_booleans_response_body_for_content_types() - ### Example @@ -2523,21 +2434,20 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_boolean_type_matches_booleans_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_boolean_type_matches_booleans_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_boolean_type_matches_booleans_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_boolean_type_matches_booleans_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**BooleanTypeMatchesBooleans**](../../models/BooleanTypeMatchesBooleans.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -bool, | BoolClass, | | ### Authorization @@ -2547,8 +2457,6 @@ No authorization required # **post_by_int_request_body** -> post_by_int_request_body(body) - ### Example @@ -2582,15 +2490,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_by_int_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_by_int_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**ByInt**](../../models/ByInt.md) | | @@ -2601,9 +2509,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_by_int_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_by_int_request_body.response_for_200.ApiResponse) | success -#### post_by_int_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -2618,8 +2526,6 @@ No authorization required # **post_by_int_response_body_for_content_types** -> ByInt post_by_int_response_body_for_content_types() - ### Example @@ -2627,7 +2533,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import content_type_json_api -from unit_test_api.model.by_int import ByInt from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -2655,16 +2560,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_by_int_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_by_int_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_by_int_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_by_int_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**ByInt**](../../models/ByInt.md) | | @@ -2678,8 +2583,6 @@ No authorization required # **post_by_number_request_body** -> post_by_number_request_body(body) - ### Example @@ -2713,15 +2616,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_by_number_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_by_number_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**ByNumber**](../../models/ByNumber.md) | | @@ -2732,9 +2635,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_by_number_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_by_number_request_body.response_for_200.ApiResponse) | success -#### post_by_number_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -2749,8 +2652,6 @@ No authorization required # **post_by_number_response_body_for_content_types** -> ByNumber post_by_number_response_body_for_content_types() - ### Example @@ -2758,7 +2659,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import content_type_json_api -from unit_test_api.model.by_number import ByNumber from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -2786,16 +2686,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_by_number_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_by_number_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_by_number_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_by_number_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**ByNumber**](../../models/ByNumber.md) | | @@ -2809,8 +2709,6 @@ No authorization required # **post_by_small_number_request_body** -> post_by_small_number_request_body(body) - ### Example @@ -2844,15 +2742,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_by_small_number_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_by_small_number_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**BySmallNumber**](../../models/BySmallNumber.md) | | @@ -2863,9 +2761,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_by_small_number_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_by_small_number_request_body.response_for_200.ApiResponse) | success -#### post_by_small_number_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -2880,8 +2778,6 @@ No authorization required # **post_by_small_number_response_body_for_content_types** -> BySmallNumber post_by_small_number_response_body_for_content_types() - ### Example @@ -2889,7 +2785,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import content_type_json_api -from unit_test_api.model.by_small_number import BySmallNumber from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -2917,16 +2812,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_by_small_number_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_by_small_number_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_by_small_number_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_by_small_number_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**BySmallNumber**](../../models/BySmallNumber.md) | | @@ -2940,8 +2835,6 @@ No authorization required # **post_date_time_format_request_body** -> post_date_time_format_request_body(body) - ### Example @@ -2949,6 +2842,7 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import content_type_json_api +from unit_test_api.model.date_time_format import DateTimeFormat from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -2962,7 +2856,7 @@ with unit_test_api.ApiClient(configuration) as api_client: api_instance = content_type_json_api.ContentTypeJsonApi(api_client) # example passing only required values which don't have defaults set - body = None + body = DateTimeFormat(None) try: api_response = api_instance.post_date_time_format_request_body( body=body, @@ -2974,29 +2868,28 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_date_time_format_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_date_time_format_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**DateTimeFormat**](../../models/DateTimeFormat.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, | frozendict.frozendict, str, decimal.Decimal, BoolClass, NoneClass, tuple, bytes, FileIO | | value must conform to RFC-3339 date-time ### Return Types, Responses Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_date_time_format_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_date_time_format_request_body.response_for_200.ApiResponse) | success -#### post_date_time_format_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -3011,8 +2904,6 @@ No authorization required # **post_date_time_format_response_body_for_content_types** -> bool, date, datetime, dict, float, int, list, str, none_type post_date_time_format_response_body_for_content_types() - ### Example @@ -3047,21 +2938,20 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_date_time_format_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_date_time_format_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_date_time_format_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_date_time_format_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**DateTimeFormat**](../../models/DateTimeFormat.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, | frozendict.frozendict, str, decimal.Decimal, BoolClass, NoneClass, tuple, bytes, FileIO | | value must conform to RFC-3339 date-time ### Authorization @@ -3071,8 +2961,6 @@ No authorization required # **post_email_format_request_body** -> post_email_format_request_body(body) - ### Example @@ -3080,6 +2968,7 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import content_type_json_api +from unit_test_api.model.email_format import EmailFormat from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -3093,7 +2982,7 @@ with unit_test_api.ApiClient(configuration) as api_client: api_instance = content_type_json_api.ContentTypeJsonApi(api_client) # example passing only required values which don't have defaults set - body = None + body = EmailFormat(None) try: api_response = api_instance.post_email_format_request_body( body=body, @@ -3105,29 +2994,28 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_email_format_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_email_format_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**EmailFormat**](../../models/EmailFormat.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, | frozendict.frozendict, str, decimal.Decimal, BoolClass, NoneClass, tuple, bytes, FileIO | | ### Return Types, Responses Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_email_format_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_email_format_request_body.response_for_200.ApiResponse) | success -#### post_email_format_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -3142,8 +3030,6 @@ No authorization required # **post_email_format_response_body_for_content_types** -> bool, date, datetime, dict, float, int, list, str, none_type post_email_format_response_body_for_content_types() - ### Example @@ -3178,21 +3064,20 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_email_format_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_email_format_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_email_format_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_email_format_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**EmailFormat**](../../models/EmailFormat.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, | frozendict.frozendict, str, decimal.Decimal, BoolClass, NoneClass, tuple, bytes, FileIO | | ### Authorization @@ -3202,8 +3087,6 @@ No authorization required # **post_enum_with0_does_not_match_false_request_body** -> post_enum_with0_does_not_match_false_request_body(body) - ### Example @@ -3237,15 +3120,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_enum_with0_does_not_match_false_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_enum_with0_does_not_match_false_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**EnumWith0DoesNotMatchFalse**](../../models/EnumWith0DoesNotMatchFalse.md) | | @@ -3256,9 +3139,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_enum_with0_does_not_match_false_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_enum_with0_does_not_match_false_request_body.response_for_200.ApiResponse) | success -#### post_enum_with0_does_not_match_false_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -3273,8 +3156,6 @@ No authorization required # **post_enum_with0_does_not_match_false_response_body_for_content_types** -> EnumWith0DoesNotMatchFalse post_enum_with0_does_not_match_false_response_body_for_content_types() - ### Example @@ -3282,7 +3163,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import content_type_json_api -from unit_test_api.model.enum_with0_does_not_match_false import EnumWith0DoesNotMatchFalse from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -3310,16 +3190,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_enum_with0_does_not_match_false_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_enum_with0_does_not_match_false_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_enum_with0_does_not_match_false_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_enum_with0_does_not_match_false_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**EnumWith0DoesNotMatchFalse**](../../models/EnumWith0DoesNotMatchFalse.md) | | @@ -3333,8 +3213,6 @@ No authorization required # **post_enum_with1_does_not_match_true_request_body** -> post_enum_with1_does_not_match_true_request_body(body) - ### Example @@ -3368,15 +3246,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_enum_with1_does_not_match_true_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_enum_with1_does_not_match_true_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**EnumWith1DoesNotMatchTrue**](../../models/EnumWith1DoesNotMatchTrue.md) | | @@ -3387,9 +3265,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_enum_with1_does_not_match_true_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_enum_with1_does_not_match_true_request_body.response_for_200.ApiResponse) | success -#### post_enum_with1_does_not_match_true_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -3404,8 +3282,6 @@ No authorization required # **post_enum_with1_does_not_match_true_response_body_for_content_types** -> EnumWith1DoesNotMatchTrue post_enum_with1_does_not_match_true_response_body_for_content_types() - ### Example @@ -3413,7 +3289,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import content_type_json_api -from unit_test_api.model.enum_with1_does_not_match_true import EnumWith1DoesNotMatchTrue from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -3441,16 +3316,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_enum_with1_does_not_match_true_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_enum_with1_does_not_match_true_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_enum_with1_does_not_match_true_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_enum_with1_does_not_match_true_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**EnumWith1DoesNotMatchTrue**](../../models/EnumWith1DoesNotMatchTrue.md) | | @@ -3464,8 +3339,6 @@ No authorization required # **post_enum_with_escaped_characters_request_body** -> post_enum_with_escaped_characters_request_body(body) - ### Example @@ -3499,15 +3372,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_enum_with_escaped_characters_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_enum_with_escaped_characters_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**EnumWithEscapedCharacters**](../../models/EnumWithEscapedCharacters.md) | | @@ -3518,9 +3391,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_enum_with_escaped_characters_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_enum_with_escaped_characters_request_body.response_for_200.ApiResponse) | success -#### post_enum_with_escaped_characters_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -3535,8 +3408,6 @@ No authorization required # **post_enum_with_escaped_characters_response_body_for_content_types** -> EnumWithEscapedCharacters post_enum_with_escaped_characters_response_body_for_content_types() - ### Example @@ -3544,7 +3415,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import content_type_json_api -from unit_test_api.model.enum_with_escaped_characters import EnumWithEscapedCharacters from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -3572,16 +3442,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_enum_with_escaped_characters_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_enum_with_escaped_characters_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_enum_with_escaped_characters_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_enum_with_escaped_characters_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**EnumWithEscapedCharacters**](../../models/EnumWithEscapedCharacters.md) | | @@ -3595,8 +3465,6 @@ No authorization required # **post_enum_with_false_does_not_match0_request_body** -> post_enum_with_false_does_not_match0_request_body(body) - ### Example @@ -3630,15 +3498,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_enum_with_false_does_not_match0_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_enum_with_false_does_not_match0_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**EnumWithFalseDoesNotMatch0**](../../models/EnumWithFalseDoesNotMatch0.md) | | @@ -3649,9 +3517,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_enum_with_false_does_not_match0_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_enum_with_false_does_not_match0_request_body.response_for_200.ApiResponse) | success -#### post_enum_with_false_does_not_match0_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -3666,8 +3534,6 @@ No authorization required # **post_enum_with_false_does_not_match0_response_body_for_content_types** -> EnumWithFalseDoesNotMatch0 post_enum_with_false_does_not_match0_response_body_for_content_types() - ### Example @@ -3675,7 +3541,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import content_type_json_api -from unit_test_api.model.enum_with_false_does_not_match0 import EnumWithFalseDoesNotMatch0 from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -3703,16 +3568,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_enum_with_false_does_not_match0_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_enum_with_false_does_not_match0_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_enum_with_false_does_not_match0_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_enum_with_false_does_not_match0_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**EnumWithFalseDoesNotMatch0**](../../models/EnumWithFalseDoesNotMatch0.md) | | @@ -3726,8 +3591,6 @@ No authorization required # **post_enum_with_true_does_not_match1_request_body** -> post_enum_with_true_does_not_match1_request_body(body) - ### Example @@ -3761,15 +3624,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_enum_with_true_does_not_match1_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_enum_with_true_does_not_match1_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**EnumWithTrueDoesNotMatch1**](../../models/EnumWithTrueDoesNotMatch1.md) | | @@ -3780,9 +3643,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_enum_with_true_does_not_match1_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_enum_with_true_does_not_match1_request_body.response_for_200.ApiResponse) | success -#### post_enum_with_true_does_not_match1_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -3797,8 +3660,6 @@ No authorization required # **post_enum_with_true_does_not_match1_response_body_for_content_types** -> EnumWithTrueDoesNotMatch1 post_enum_with_true_does_not_match1_response_body_for_content_types() - ### Example @@ -3806,7 +3667,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import content_type_json_api -from unit_test_api.model.enum_with_true_does_not_match1 import EnumWithTrueDoesNotMatch1 from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -3834,16 +3694,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_enum_with_true_does_not_match1_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_enum_with_true_does_not_match1_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_enum_with_true_does_not_match1_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_enum_with_true_does_not_match1_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**EnumWithTrueDoesNotMatch1**](../../models/EnumWithTrueDoesNotMatch1.md) | | @@ -3857,8 +3717,6 @@ No authorization required # **post_enums_in_properties_request_body** -> post_enums_in_properties_request_body(enums_in_properties) - ### Example @@ -3895,15 +3753,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_enums_in_properties_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_enums_in_properties_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**EnumsInProperties**](../../models/EnumsInProperties.md) | | @@ -3914,9 +3772,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_enums_in_properties_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_enums_in_properties_request_body.response_for_200.ApiResponse) | success -#### post_enums_in_properties_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -3931,8 +3789,6 @@ No authorization required # **post_enums_in_properties_response_body_for_content_types** -> EnumsInProperties post_enums_in_properties_response_body_for_content_types() - ### Example @@ -3940,7 +3796,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import content_type_json_api -from unit_test_api.model.enums_in_properties import EnumsInProperties from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -3968,16 +3823,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_enums_in_properties_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_enums_in_properties_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_enums_in_properties_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_enums_in_properties_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**EnumsInProperties**](../../models/EnumsInProperties.md) | | @@ -3991,8 +3846,6 @@ No authorization required # **post_forbidden_property_request_body** -> post_forbidden_property_request_body(forbidden_property) - ### Example @@ -4026,15 +3879,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_forbidden_property_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_forbidden_property_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**ForbiddenProperty**](../../models/ForbiddenProperty.md) | | @@ -4045,9 +3898,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_forbidden_property_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_forbidden_property_request_body.response_for_200.ApiResponse) | success -#### post_forbidden_property_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -4062,8 +3915,6 @@ No authorization required # **post_forbidden_property_response_body_for_content_types** -> ForbiddenProperty post_forbidden_property_response_body_for_content_types() - ### Example @@ -4071,7 +3922,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import content_type_json_api -from unit_test_api.model.forbidden_property import ForbiddenProperty from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -4099,16 +3949,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_forbidden_property_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_forbidden_property_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_forbidden_property_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_forbidden_property_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**ForbiddenProperty**](../../models/ForbiddenProperty.md) | | @@ -4122,8 +3972,6 @@ No authorization required # **post_hostname_format_request_body** -> post_hostname_format_request_body(body) - ### Example @@ -4131,6 +3979,7 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import content_type_json_api +from unit_test_api.model.hostname_format import HostnameFormat from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -4144,7 +3993,7 @@ with unit_test_api.ApiClient(configuration) as api_client: api_instance = content_type_json_api.ContentTypeJsonApi(api_client) # example passing only required values which don't have defaults set - body = None + body = HostnameFormat(None) try: api_response = api_instance.post_hostname_format_request_body( body=body, @@ -4156,29 +4005,28 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_hostname_format_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_hostname_format_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**HostnameFormat**](../../models/HostnameFormat.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, | frozendict.frozendict, str, decimal.Decimal, BoolClass, NoneClass, tuple, bytes, FileIO | | ### Return Types, Responses Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_hostname_format_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_hostname_format_request_body.response_for_200.ApiResponse) | success -#### post_hostname_format_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -4193,8 +4041,6 @@ No authorization required # **post_hostname_format_response_body_for_content_types** -> bool, date, datetime, dict, float, int, list, str, none_type post_hostname_format_response_body_for_content_types() - ### Example @@ -4229,21 +4075,20 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_hostname_format_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_hostname_format_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_hostname_format_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_hostname_format_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**HostnameFormat**](../../models/HostnameFormat.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, | frozendict.frozendict, str, decimal.Decimal, BoolClass, NoneClass, tuple, bytes, FileIO | | ### Authorization @@ -4253,8 +4098,6 @@ No authorization required # **post_integer_type_matches_integers_request_body** -> post_integer_type_matches_integers_request_body(body) - ### Example @@ -4262,6 +4105,7 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import content_type_json_api +from unit_test_api.model.integer_type_matches_integers import IntegerTypeMatchesIntegers from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -4275,7 +4119,7 @@ with unit_test_api.ApiClient(configuration) as api_client: api_instance = content_type_json_api.ContentTypeJsonApi(api_client) # example passing only required values which don't have defaults set - body = 1 + body = IntegerTypeMatchesIntegers(1) try: api_response = api_instance.post_integer_type_matches_integers_request_body( body=body, @@ -4287,29 +4131,28 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_integer_type_matches_integers_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_integer_type_matches_integers_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**IntegerTypeMatchesIntegers**](../../models/IntegerTypeMatchesIntegers.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -decimal.Decimal, int, | decimal.Decimal, | | ### Return Types, Responses Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_integer_type_matches_integers_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_integer_type_matches_integers_request_body.response_for_200.ApiResponse) | success -#### post_integer_type_matches_integers_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -4324,8 +4167,6 @@ No authorization required # **post_integer_type_matches_integers_response_body_for_content_types** -> int post_integer_type_matches_integers_response_body_for_content_types() - ### Example @@ -4360,21 +4201,20 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_integer_type_matches_integers_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_integer_type_matches_integers_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_integer_type_matches_integers_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_integer_type_matches_integers_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**IntegerTypeMatchesIntegers**](../../models/IntegerTypeMatchesIntegers.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -decimal.Decimal, int, | decimal.Decimal, | | ### Authorization @@ -4384,8 +4224,6 @@ No authorization required # **post_invalid_instance_should_not_raise_error_when_float_division_inf_request_body** -> post_invalid_instance_should_not_raise_error_when_float_division_inf_request_body(body) - ### Example @@ -4419,15 +4257,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_invalid_instance_should_not_raise_error_when_float_division_inf_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_invalid_instance_should_not_raise_error_when_float_division_inf_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf**](../../models/InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf.md) | | @@ -4438,9 +4276,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_invalid_instance_should_not_raise_error_when_float_division_inf_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_invalid_instance_should_not_raise_error_when_float_division_inf_request_body.response_for_200.ApiResponse) | success -#### post_invalid_instance_should_not_raise_error_when_float_division_inf_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -4455,8 +4293,6 @@ No authorization required # **post_invalid_instance_should_not_raise_error_when_float_division_inf_response_body_for_content_types** -> InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf post_invalid_instance_should_not_raise_error_when_float_division_inf_response_body_for_content_types() - ### Example @@ -4464,7 +4300,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import content_type_json_api -from unit_test_api.model.invalid_instance_should_not_raise_error_when_float_division_inf import InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -4492,16 +4327,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_invalid_instance_should_not_raise_error_when_float_division_inf_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_invalid_instance_should_not_raise_error_when_float_division_inf_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_invalid_instance_should_not_raise_error_when_float_division_inf_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_invalid_instance_should_not_raise_error_when_float_division_inf_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf**](../../models/InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf.md) | | @@ -4515,8 +4350,6 @@ No authorization required # **post_invalid_string_value_for_default_request_body** -> post_invalid_string_value_for_default_request_body(invalid_string_value_for_default) - ### Example @@ -4550,15 +4383,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_invalid_string_value_for_default_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_invalid_string_value_for_default_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**InvalidStringValueForDefault**](../../models/InvalidStringValueForDefault.md) | | @@ -4569,9 +4402,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_invalid_string_value_for_default_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_invalid_string_value_for_default_request_body.response_for_200.ApiResponse) | success -#### post_invalid_string_value_for_default_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -4586,8 +4419,6 @@ No authorization required # **post_invalid_string_value_for_default_response_body_for_content_types** -> InvalidStringValueForDefault post_invalid_string_value_for_default_response_body_for_content_types() - ### Example @@ -4595,7 +4426,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import content_type_json_api -from unit_test_api.model.invalid_string_value_for_default import InvalidStringValueForDefault from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -4623,16 +4453,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_invalid_string_value_for_default_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_invalid_string_value_for_default_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_invalid_string_value_for_default_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_invalid_string_value_for_default_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**InvalidStringValueForDefault**](../../models/InvalidStringValueForDefault.md) | | @@ -4646,8 +4476,6 @@ No authorization required # **post_ipv4_format_request_body** -> post_ipv4_format_request_body(body) - ### Example @@ -4655,6 +4483,7 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import content_type_json_api +from unit_test_api.model.ipv4_format import Ipv4Format from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -4668,7 +4497,7 @@ with unit_test_api.ApiClient(configuration) as api_client: api_instance = content_type_json_api.ContentTypeJsonApi(api_client) # example passing only required values which don't have defaults set - body = None + body = Ipv4Format(None) try: api_response = api_instance.post_ipv4_format_request_body( body=body, @@ -4680,29 +4509,28 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_ipv4_format_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_ipv4_format_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**Ipv4Format**](../../models/Ipv4Format.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, | frozendict.frozendict, str, decimal.Decimal, BoolClass, NoneClass, tuple, bytes, FileIO | | ### Return Types, Responses Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_ipv4_format_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_ipv4_format_request_body.response_for_200.ApiResponse) | success -#### post_ipv4_format_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -4717,8 +4545,6 @@ No authorization required # **post_ipv4_format_response_body_for_content_types** -> bool, date, datetime, dict, float, int, list, str, none_type post_ipv4_format_response_body_for_content_types() - ### Example @@ -4753,21 +4579,20 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_ipv4_format_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_ipv4_format_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_ipv4_format_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_ipv4_format_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**Ipv4Format**](../../models/Ipv4Format.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, | frozendict.frozendict, str, decimal.Decimal, BoolClass, NoneClass, tuple, bytes, FileIO | | ### Authorization @@ -4777,8 +4602,6 @@ No authorization required # **post_ipv6_format_request_body** -> post_ipv6_format_request_body(body) - ### Example @@ -4786,6 +4609,7 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import content_type_json_api +from unit_test_api.model.ipv6_format import Ipv6Format from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -4799,7 +4623,7 @@ with unit_test_api.ApiClient(configuration) as api_client: api_instance = content_type_json_api.ContentTypeJsonApi(api_client) # example passing only required values which don't have defaults set - body = None + body = Ipv6Format(None) try: api_response = api_instance.post_ipv6_format_request_body( body=body, @@ -4811,29 +4635,28 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_ipv6_format_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_ipv6_format_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**Ipv6Format**](../../models/Ipv6Format.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, | frozendict.frozendict, str, decimal.Decimal, BoolClass, NoneClass, tuple, bytes, FileIO | | ### Return Types, Responses Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_ipv6_format_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_ipv6_format_request_body.response_for_200.ApiResponse) | success -#### post_ipv6_format_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -4848,8 +4671,6 @@ No authorization required # **post_ipv6_format_response_body_for_content_types** -> bool, date, datetime, dict, float, int, list, str, none_type post_ipv6_format_response_body_for_content_types() - ### Example @@ -4884,21 +4705,20 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_ipv6_format_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_ipv6_format_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_ipv6_format_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_ipv6_format_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**Ipv6Format**](../../models/Ipv6Format.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, | frozendict.frozendict, str, decimal.Decimal, BoolClass, NoneClass, tuple, bytes, FileIO | | ### Authorization @@ -4908,8 +4728,6 @@ No authorization required # **post_json_pointer_format_request_body** -> post_json_pointer_format_request_body(body) - ### Example @@ -4917,6 +4735,7 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import content_type_json_api +from unit_test_api.model.json_pointer_format import JsonPointerFormat from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -4930,7 +4749,7 @@ with unit_test_api.ApiClient(configuration) as api_client: api_instance = content_type_json_api.ContentTypeJsonApi(api_client) # example passing only required values which don't have defaults set - body = None + body = JsonPointerFormat(None) try: api_response = api_instance.post_json_pointer_format_request_body( body=body, @@ -4942,29 +4761,28 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_json_pointer_format_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_json_pointer_format_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**JsonPointerFormat**](../../models/JsonPointerFormat.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, | frozendict.frozendict, str, decimal.Decimal, BoolClass, NoneClass, tuple, bytes, FileIO | | ### Return Types, Responses Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_json_pointer_format_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_json_pointer_format_request_body.response_for_200.ApiResponse) | success -#### post_json_pointer_format_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -4979,8 +4797,6 @@ No authorization required # **post_json_pointer_format_response_body_for_content_types** -> bool, date, datetime, dict, float, int, list, str, none_type post_json_pointer_format_response_body_for_content_types() - ### Example @@ -5015,21 +4831,20 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_json_pointer_format_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_json_pointer_format_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_json_pointer_format_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_json_pointer_format_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**JsonPointerFormat**](../../models/JsonPointerFormat.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, | frozendict.frozendict, str, decimal.Decimal, BoolClass, NoneClass, tuple, bytes, FileIO | | ### Authorization @@ -5039,8 +4854,6 @@ No authorization required # **post_maximum_validation_request_body** -> post_maximum_validation_request_body(body) - ### Example @@ -5074,15 +4887,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_maximum_validation_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_maximum_validation_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**MaximumValidation**](../../models/MaximumValidation.md) | | @@ -5093,9 +4906,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_maximum_validation_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_maximum_validation_request_body.response_for_200.ApiResponse) | success -#### post_maximum_validation_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -5110,8 +4923,6 @@ No authorization required # **post_maximum_validation_response_body_for_content_types** -> MaximumValidation post_maximum_validation_response_body_for_content_types() - ### Example @@ -5119,7 +4930,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import content_type_json_api -from unit_test_api.model.maximum_validation import MaximumValidation from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -5147,16 +4957,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_maximum_validation_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_maximum_validation_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_maximum_validation_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_maximum_validation_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**MaximumValidation**](../../models/MaximumValidation.md) | | @@ -5170,8 +4980,6 @@ No authorization required # **post_maximum_validation_with_unsigned_integer_request_body** -> post_maximum_validation_with_unsigned_integer_request_body(body) - ### Example @@ -5205,15 +5013,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_maximum_validation_with_unsigned_integer_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_maximum_validation_with_unsigned_integer_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**MaximumValidationWithUnsignedInteger**](../../models/MaximumValidationWithUnsignedInteger.md) | | @@ -5224,9 +5032,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_maximum_validation_with_unsigned_integer_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_maximum_validation_with_unsigned_integer_request_body.response_for_200.ApiResponse) | success -#### post_maximum_validation_with_unsigned_integer_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -5241,8 +5049,6 @@ No authorization required # **post_maximum_validation_with_unsigned_integer_response_body_for_content_types** -> MaximumValidationWithUnsignedInteger post_maximum_validation_with_unsigned_integer_response_body_for_content_types() - ### Example @@ -5250,7 +5056,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import content_type_json_api -from unit_test_api.model.maximum_validation_with_unsigned_integer import MaximumValidationWithUnsignedInteger from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -5278,16 +5083,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_maximum_validation_with_unsigned_integer_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_maximum_validation_with_unsigned_integer_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_maximum_validation_with_unsigned_integer_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_maximum_validation_with_unsigned_integer_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**MaximumValidationWithUnsignedInteger**](../../models/MaximumValidationWithUnsignedInteger.md) | | @@ -5301,8 +5106,6 @@ No authorization required # **post_maxitems_validation_request_body** -> post_maxitems_validation_request_body(body) - ### Example @@ -5336,15 +5139,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_maxitems_validation_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_maxitems_validation_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**MaxitemsValidation**](../../models/MaxitemsValidation.md) | | @@ -5355,9 +5158,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_maxitems_validation_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_maxitems_validation_request_body.response_for_200.ApiResponse) | success -#### post_maxitems_validation_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -5372,8 +5175,6 @@ No authorization required # **post_maxitems_validation_response_body_for_content_types** -> MaxitemsValidation post_maxitems_validation_response_body_for_content_types() - ### Example @@ -5381,7 +5182,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import content_type_json_api -from unit_test_api.model.maxitems_validation import MaxitemsValidation from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -5409,16 +5209,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_maxitems_validation_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_maxitems_validation_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_maxitems_validation_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_maxitems_validation_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**MaxitemsValidation**](../../models/MaxitemsValidation.md) | | @@ -5432,8 +5232,6 @@ No authorization required # **post_maxlength_validation_request_body** -> post_maxlength_validation_request_body(body) - ### Example @@ -5467,15 +5265,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_maxlength_validation_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_maxlength_validation_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**MaxlengthValidation**](../../models/MaxlengthValidation.md) | | @@ -5486,9 +5284,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_maxlength_validation_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_maxlength_validation_request_body.response_for_200.ApiResponse) | success -#### post_maxlength_validation_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -5503,8 +5301,6 @@ No authorization required # **post_maxlength_validation_response_body_for_content_types** -> MaxlengthValidation post_maxlength_validation_response_body_for_content_types() - ### Example @@ -5512,7 +5308,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import content_type_json_api -from unit_test_api.model.maxlength_validation import MaxlengthValidation from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -5540,16 +5335,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_maxlength_validation_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_maxlength_validation_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_maxlength_validation_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_maxlength_validation_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**MaxlengthValidation**](../../models/MaxlengthValidation.md) | | @@ -5563,8 +5358,6 @@ No authorization required # **post_maxproperties0_means_the_object_is_empty_request_body** -> post_maxproperties0_means_the_object_is_empty_request_body(body) - ### Example @@ -5598,15 +5391,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_maxproperties0_means_the_object_is_empty_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_maxproperties0_means_the_object_is_empty_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**Maxproperties0MeansTheObjectIsEmpty**](../../models/Maxproperties0MeansTheObjectIsEmpty.md) | | @@ -5617,9 +5410,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_maxproperties0_means_the_object_is_empty_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_maxproperties0_means_the_object_is_empty_request_body.response_for_200.ApiResponse) | success -#### post_maxproperties0_means_the_object_is_empty_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -5634,8 +5427,6 @@ No authorization required # **post_maxproperties0_means_the_object_is_empty_response_body_for_content_types** -> Maxproperties0MeansTheObjectIsEmpty post_maxproperties0_means_the_object_is_empty_response_body_for_content_types() - ### Example @@ -5643,7 +5434,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import content_type_json_api -from unit_test_api.model.maxproperties0_means_the_object_is_empty import Maxproperties0MeansTheObjectIsEmpty from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -5671,16 +5461,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_maxproperties0_means_the_object_is_empty_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_maxproperties0_means_the_object_is_empty_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_maxproperties0_means_the_object_is_empty_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_maxproperties0_means_the_object_is_empty_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**Maxproperties0MeansTheObjectIsEmpty**](../../models/Maxproperties0MeansTheObjectIsEmpty.md) | | @@ -5694,8 +5484,6 @@ No authorization required # **post_maxproperties_validation_request_body** -> post_maxproperties_validation_request_body(body) - ### Example @@ -5729,15 +5517,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_maxproperties_validation_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_maxproperties_validation_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**MaxpropertiesValidation**](../../models/MaxpropertiesValidation.md) | | @@ -5748,9 +5536,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_maxproperties_validation_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_maxproperties_validation_request_body.response_for_200.ApiResponse) | success -#### post_maxproperties_validation_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -5765,8 +5553,6 @@ No authorization required # **post_maxproperties_validation_response_body_for_content_types** -> MaxpropertiesValidation post_maxproperties_validation_response_body_for_content_types() - ### Example @@ -5774,7 +5560,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import content_type_json_api -from unit_test_api.model.maxproperties_validation import MaxpropertiesValidation from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -5802,16 +5587,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_maxproperties_validation_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_maxproperties_validation_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_maxproperties_validation_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_maxproperties_validation_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**MaxpropertiesValidation**](../../models/MaxpropertiesValidation.md) | | @@ -5825,8 +5610,6 @@ No authorization required # **post_minimum_validation_request_body** -> post_minimum_validation_request_body(body) - ### Example @@ -5860,15 +5643,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_minimum_validation_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_minimum_validation_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**MinimumValidation**](../../models/MinimumValidation.md) | | @@ -5879,9 +5662,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_minimum_validation_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_minimum_validation_request_body.response_for_200.ApiResponse) | success -#### post_minimum_validation_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -5896,8 +5679,6 @@ No authorization required # **post_minimum_validation_response_body_for_content_types** -> MinimumValidation post_minimum_validation_response_body_for_content_types() - ### Example @@ -5905,7 +5686,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import content_type_json_api -from unit_test_api.model.minimum_validation import MinimumValidation from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -5933,16 +5713,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_minimum_validation_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_minimum_validation_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_minimum_validation_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_minimum_validation_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**MinimumValidation**](../../models/MinimumValidation.md) | | @@ -5956,8 +5736,6 @@ No authorization required # **post_minimum_validation_with_signed_integer_request_body** -> post_minimum_validation_with_signed_integer_request_body(body) - ### Example @@ -5991,15 +5769,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_minimum_validation_with_signed_integer_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_minimum_validation_with_signed_integer_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**MinimumValidationWithSignedInteger**](../../models/MinimumValidationWithSignedInteger.md) | | @@ -6010,9 +5788,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_minimum_validation_with_signed_integer_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_minimum_validation_with_signed_integer_request_body.response_for_200.ApiResponse) | success -#### post_minimum_validation_with_signed_integer_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -6027,8 +5805,6 @@ No authorization required # **post_minimum_validation_with_signed_integer_response_body_for_content_types** -> MinimumValidationWithSignedInteger post_minimum_validation_with_signed_integer_response_body_for_content_types() - ### Example @@ -6036,7 +5812,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import content_type_json_api -from unit_test_api.model.minimum_validation_with_signed_integer import MinimumValidationWithSignedInteger from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -6064,16 +5839,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_minimum_validation_with_signed_integer_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_minimum_validation_with_signed_integer_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_minimum_validation_with_signed_integer_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_minimum_validation_with_signed_integer_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**MinimumValidationWithSignedInteger**](../../models/MinimumValidationWithSignedInteger.md) | | @@ -6087,8 +5862,6 @@ No authorization required # **post_minitems_validation_request_body** -> post_minitems_validation_request_body(body) - ### Example @@ -6122,15 +5895,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_minitems_validation_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_minitems_validation_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**MinitemsValidation**](../../models/MinitemsValidation.md) | | @@ -6141,9 +5914,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_minitems_validation_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_minitems_validation_request_body.response_for_200.ApiResponse) | success -#### post_minitems_validation_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -6158,8 +5931,6 @@ No authorization required # **post_minitems_validation_response_body_for_content_types** -> MinitemsValidation post_minitems_validation_response_body_for_content_types() - ### Example @@ -6167,7 +5938,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import content_type_json_api -from unit_test_api.model.minitems_validation import MinitemsValidation from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -6195,16 +5965,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_minitems_validation_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_minitems_validation_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_minitems_validation_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_minitems_validation_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**MinitemsValidation**](../../models/MinitemsValidation.md) | | @@ -6218,8 +5988,6 @@ No authorization required # **post_minlength_validation_request_body** -> post_minlength_validation_request_body(body) - ### Example @@ -6253,15 +6021,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_minlength_validation_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_minlength_validation_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**MinlengthValidation**](../../models/MinlengthValidation.md) | | @@ -6272,9 +6040,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_minlength_validation_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_minlength_validation_request_body.response_for_200.ApiResponse) | success -#### post_minlength_validation_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -6289,8 +6057,6 @@ No authorization required # **post_minlength_validation_response_body_for_content_types** -> MinlengthValidation post_minlength_validation_response_body_for_content_types() - ### Example @@ -6298,7 +6064,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import content_type_json_api -from unit_test_api.model.minlength_validation import MinlengthValidation from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -6326,16 +6091,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_minlength_validation_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_minlength_validation_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_minlength_validation_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_minlength_validation_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**MinlengthValidation**](../../models/MinlengthValidation.md) | | @@ -6349,8 +6114,6 @@ No authorization required # **post_minproperties_validation_request_body** -> post_minproperties_validation_request_body(body) - ### Example @@ -6384,15 +6147,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_minproperties_validation_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_minproperties_validation_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**MinpropertiesValidation**](../../models/MinpropertiesValidation.md) | | @@ -6403,9 +6166,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_minproperties_validation_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_minproperties_validation_request_body.response_for_200.ApiResponse) | success -#### post_minproperties_validation_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -6420,8 +6183,6 @@ No authorization required # **post_minproperties_validation_response_body_for_content_types** -> MinpropertiesValidation post_minproperties_validation_response_body_for_content_types() - ### Example @@ -6429,7 +6190,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import content_type_json_api -from unit_test_api.model.minproperties_validation import MinpropertiesValidation from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -6457,16 +6217,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_minproperties_validation_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_minproperties_validation_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_minproperties_validation_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_minproperties_validation_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**MinpropertiesValidation**](../../models/MinpropertiesValidation.md) | | @@ -6480,8 +6240,6 @@ No authorization required # **post_nested_allof_to_check_validation_semantics_request_body** -> post_nested_allof_to_check_validation_semantics_request_body(nested_allof_to_check_validation_semantics) - ### Example @@ -6515,15 +6273,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_nested_allof_to_check_validation_semantics_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_nested_allof_to_check_validation_semantics_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**NestedAllofToCheckValidationSemantics**](../../models/NestedAllofToCheckValidationSemantics.md) | | @@ -6534,9 +6292,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_nested_allof_to_check_validation_semantics_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_nested_allof_to_check_validation_semantics_request_body.response_for_200.ApiResponse) | success -#### post_nested_allof_to_check_validation_semantics_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -6551,8 +6309,6 @@ No authorization required # **post_nested_allof_to_check_validation_semantics_response_body_for_content_types** -> NestedAllofToCheckValidationSemantics post_nested_allof_to_check_validation_semantics_response_body_for_content_types() - ### Example @@ -6560,7 +6316,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import content_type_json_api -from unit_test_api.model.nested_allof_to_check_validation_semantics import NestedAllofToCheckValidationSemantics from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -6588,16 +6343,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_nested_allof_to_check_validation_semantics_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_nested_allof_to_check_validation_semantics_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_nested_allof_to_check_validation_semantics_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_nested_allof_to_check_validation_semantics_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**NestedAllofToCheckValidationSemantics**](../../models/NestedAllofToCheckValidationSemantics.md) | | @@ -6611,8 +6366,6 @@ No authorization required # **post_nested_anyof_to_check_validation_semantics_request_body** -> post_nested_anyof_to_check_validation_semantics_request_body(nested_anyof_to_check_validation_semantics) - ### Example @@ -6646,15 +6399,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_nested_anyof_to_check_validation_semantics_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_nested_anyof_to_check_validation_semantics_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**NestedAnyofToCheckValidationSemantics**](../../models/NestedAnyofToCheckValidationSemantics.md) | | @@ -6665,9 +6418,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_nested_anyof_to_check_validation_semantics_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_nested_anyof_to_check_validation_semantics_request_body.response_for_200.ApiResponse) | success -#### post_nested_anyof_to_check_validation_semantics_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -6682,8 +6435,6 @@ No authorization required # **post_nested_anyof_to_check_validation_semantics_response_body_for_content_types** -> NestedAnyofToCheckValidationSemantics post_nested_anyof_to_check_validation_semantics_response_body_for_content_types() - ### Example @@ -6691,7 +6442,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import content_type_json_api -from unit_test_api.model.nested_anyof_to_check_validation_semantics import NestedAnyofToCheckValidationSemantics from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -6719,16 +6469,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_nested_anyof_to_check_validation_semantics_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_nested_anyof_to_check_validation_semantics_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_nested_anyof_to_check_validation_semantics_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_nested_anyof_to_check_validation_semantics_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**NestedAnyofToCheckValidationSemantics**](../../models/NestedAnyofToCheckValidationSemantics.md) | | @@ -6742,8 +6492,6 @@ No authorization required # **post_nested_items_request_body** -> post_nested_items_request_body(nested_items) - ### Example @@ -6785,15 +6533,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_nested_items_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_nested_items_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**NestedItems**](../../models/NestedItems.md) | | @@ -6804,9 +6552,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_nested_items_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_nested_items_request_body.response_for_200.ApiResponse) | success -#### post_nested_items_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -6821,8 +6569,6 @@ No authorization required # **post_nested_items_response_body_for_content_types** -> NestedItems post_nested_items_response_body_for_content_types() - ### Example @@ -6830,7 +6576,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import content_type_json_api -from unit_test_api.model.nested_items import NestedItems from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -6858,16 +6603,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_nested_items_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_nested_items_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_nested_items_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_nested_items_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**NestedItems**](../../models/NestedItems.md) | | @@ -6881,8 +6626,6 @@ No authorization required # **post_nested_oneof_to_check_validation_semantics_request_body** -> post_nested_oneof_to_check_validation_semantics_request_body(nested_oneof_to_check_validation_semantics) - ### Example @@ -6916,15 +6659,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_nested_oneof_to_check_validation_semantics_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_nested_oneof_to_check_validation_semantics_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**NestedOneofToCheckValidationSemantics**](../../models/NestedOneofToCheckValidationSemantics.md) | | @@ -6935,9 +6678,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_nested_oneof_to_check_validation_semantics_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_nested_oneof_to_check_validation_semantics_request_body.response_for_200.ApiResponse) | success -#### post_nested_oneof_to_check_validation_semantics_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -6952,8 +6695,6 @@ No authorization required # **post_nested_oneof_to_check_validation_semantics_response_body_for_content_types** -> NestedOneofToCheckValidationSemantics post_nested_oneof_to_check_validation_semantics_response_body_for_content_types() - ### Example @@ -6961,7 +6702,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import content_type_json_api -from unit_test_api.model.nested_oneof_to_check_validation_semantics import NestedOneofToCheckValidationSemantics from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -6989,16 +6729,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_nested_oneof_to_check_validation_semantics_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_nested_oneof_to_check_validation_semantics_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_nested_oneof_to_check_validation_semantics_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_nested_oneof_to_check_validation_semantics_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**NestedOneofToCheckValidationSemantics**](../../models/NestedOneofToCheckValidationSemantics.md) | | @@ -7012,8 +6752,6 @@ No authorization required # **post_not_more_complex_schema_request_body** -> post_not_more_complex_schema_request_body(body) - ### Example @@ -7021,6 +6759,7 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import content_type_json_api +from unit_test_api.model.not_more_complex_schema import NotMoreComplexSchema from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -7034,7 +6773,7 @@ with unit_test_api.ApiClient(configuration) as api_client: api_instance = content_type_json_api.ContentTypeJsonApi(api_client) # example passing only required values which don't have defaults set - body = None + body = NotMoreComplexSchema(None) try: api_response = api_instance.post_not_more_complex_schema_request_body( body=body, @@ -7046,48 +6785,28 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_not_more_complex_schema_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_not_more_complex_schema_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body - -# SchemaForRequestBodyApplicationJson - -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, | frozendict.frozendict, str, decimal.Decimal, BoolClass, NoneClass, tuple, bytes, FileIO | | - -### Composed Schemas (allOf/anyOf/oneOf/not) -#### not -Class Name | Input Type | Accessed Type | Description | Notes -------------- | ------------- | ------------- | ------------- | ------------- -[not_schema](#not_schema) | dict, frozendict.frozendict, | frozendict.frozendict, | | +### body -# not_schema - -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, | frozendict.frozendict, | | +# RequestBody.Schemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**NotMoreComplexSchema**](../../models/NotMoreComplexSchema.md) | | -### Dictionary Keys -Key | Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- | ------------- -**foo** | str, | str, | | [optional] -**any_string_name** | dict, frozendict.frozendict, str, date, datetime, int, float, bool, decimal.Decimal, None, list, tuple, bytes, io.FileIO, io.BufferedReader | frozendict.frozendict, str, BoolClass, decimal.Decimal, NoneClass, tuple, bytes, FileIO | any string name can be used but the value must be the correct type | [optional] ### Return Types, Responses Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_not_more_complex_schema_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_not_more_complex_schema_request_body.response_for_200.ApiResponse) | success -#### post_not_more_complex_schema_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -7102,8 +6821,6 @@ No authorization required # **post_not_more_complex_schema_response_body_for_content_types** -> bool, date, datetime, dict, float, int, list, str, none_type post_not_more_complex_schema_response_body_for_content_types() - ### Example @@ -7138,40 +6855,20 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_not_more_complex_schema_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_not_more_complex_schema_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_not_more_complex_schema_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_not_more_complex_schema_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson - -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, | frozendict.frozendict, str, decimal.Decimal, BoolClass, NoneClass, tuple, bytes, FileIO | | - -### Composed Schemas (allOf/anyOf/oneOf/not) -#### not -Class Name | Input Type | Accessed Type | Description | Notes -------------- | ------------- | ------------- | ------------- | ------------- -[not_schema](#not_schema) | dict, frozendict.frozendict, | frozendict.frozendict, | | - -# not_schema - -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, | frozendict.frozendict, | | +# response_for_200.BodySchemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**NotMoreComplexSchema**](../../models/NotMoreComplexSchema.md) | | -### Dictionary Keys -Key | Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- | ------------- -**foo** | str, | str, | | [optional] -**any_string_name** | dict, frozendict.frozendict, str, date, datetime, int, float, bool, decimal.Decimal, None, list, tuple, bytes, io.FileIO, io.BufferedReader | frozendict.frozendict, str, BoolClass, decimal.Decimal, NoneClass, tuple, bytes, FileIO | any string name can be used but the value must be the correct type | [optional] ### Authorization @@ -7181,8 +6878,6 @@ No authorization required # **post_not_request_body** -> post_not_request_body(body) - ### Example @@ -7190,6 +6885,7 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import content_type_json_api +from unit_test_api.model.model_not import ModelNot from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -7203,7 +6899,7 @@ with unit_test_api.ApiClient(configuration) as api_client: api_instance = content_type_json_api.ContentTypeJsonApi(api_client) # example passing only required values which don't have defaults set - body = None + body = ModelNot(None) try: api_response = api_instance.post_not_request_body( body=body, @@ -7215,42 +6911,28 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_not_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_not_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson - -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, | frozendict.frozendict, str, decimal.Decimal, BoolClass, NoneClass, tuple, bytes, FileIO | | - -### Composed Schemas (allOf/anyOf/oneOf/not) -#### not -Class Name | Input Type | Accessed Type | Description | Notes -------------- | ------------- | ------------- | ------------- | ------------- -[not_schema](#not_schema) | decimal.Decimal, int, | decimal.Decimal, | | - -# not_schema +# RequestBody.Schemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**ModelNot**](../../models/ModelNot.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -decimal.Decimal, int, | decimal.Decimal, | | ### Return Types, Responses Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_not_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_not_request_body.response_for_200.ApiResponse) | success -#### post_not_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -7265,8 +6947,6 @@ No authorization required # **post_not_response_body_for_content_types** -> bool, date, datetime, dict, float, int, list, str, none_type post_not_response_body_for_content_types() - ### Example @@ -7301,34 +6981,20 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_not_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_not_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_not_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_not_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson - -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, | frozendict.frozendict, str, decimal.Decimal, BoolClass, NoneClass, tuple, bytes, FileIO | | - -### Composed Schemas (allOf/anyOf/oneOf/not) -#### not -Class Name | Input Type | Accessed Type | Description | Notes -------------- | ------------- | ------------- | ------------- | ------------- -[not_schema](#not_schema) | decimal.Decimal, int, | decimal.Decimal, | | - -# not_schema +# response_for_200.BodySchemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**ModelNot**](../../models/ModelNot.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -decimal.Decimal, int, | decimal.Decimal, | | ### Authorization @@ -7338,8 +7004,6 @@ No authorization required # **post_nul_characters_in_strings_request_body** -> post_nul_characters_in_strings_request_body(body) - ### Example @@ -7373,15 +7037,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_nul_characters_in_strings_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_nul_characters_in_strings_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**NulCharactersInStrings**](../../models/NulCharactersInStrings.md) | | @@ -7392,9 +7056,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_nul_characters_in_strings_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_nul_characters_in_strings_request_body.response_for_200.ApiResponse) | success -#### post_nul_characters_in_strings_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -7409,8 +7073,6 @@ No authorization required # **post_nul_characters_in_strings_response_body_for_content_types** -> NulCharactersInStrings post_nul_characters_in_strings_response_body_for_content_types() - ### Example @@ -7418,7 +7080,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import content_type_json_api -from unit_test_api.model.nul_characters_in_strings import NulCharactersInStrings from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -7446,16 +7107,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_nul_characters_in_strings_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_nul_characters_in_strings_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_nul_characters_in_strings_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_nul_characters_in_strings_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**NulCharactersInStrings**](../../models/NulCharactersInStrings.md) | | @@ -7469,8 +7130,6 @@ No authorization required # **post_null_type_matches_only_the_null_object_request_body** -> post_null_type_matches_only_the_null_object_request_body(body) - ### Example @@ -7478,6 +7137,7 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import content_type_json_api +from unit_test_api.model.null_type_matches_only_the_null_object import NullTypeMatchesOnlyTheNullObject from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -7491,7 +7151,7 @@ with unit_test_api.ApiClient(configuration) as api_client: api_instance = content_type_json_api.ContentTypeJsonApi(api_client) # example passing only required values which don't have defaults set - body = None + body = NullTypeMatchesOnlyTheNullObject(None) try: api_response = api_instance.post_null_type_matches_only_the_null_object_request_body( body=body, @@ -7503,29 +7163,28 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_null_type_matches_only_the_null_object_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_null_type_matches_only_the_null_object_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**NullTypeMatchesOnlyTheNullObject**](../../models/NullTypeMatchesOnlyTheNullObject.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -None, | NoneClass, | | ### Return Types, Responses Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_null_type_matches_only_the_null_object_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_null_type_matches_only_the_null_object_request_body.response_for_200.ApiResponse) | success -#### post_null_type_matches_only_the_null_object_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -7540,8 +7199,6 @@ No authorization required # **post_null_type_matches_only_the_null_object_response_body_for_content_types** -> none_type post_null_type_matches_only_the_null_object_response_body_for_content_types() - ### Example @@ -7576,21 +7233,20 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_null_type_matches_only_the_null_object_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_null_type_matches_only_the_null_object_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_null_type_matches_only_the_null_object_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_null_type_matches_only_the_null_object_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**NullTypeMatchesOnlyTheNullObject**](../../models/NullTypeMatchesOnlyTheNullObject.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -None, | NoneClass, | | ### Authorization @@ -7600,8 +7256,6 @@ No authorization required # **post_number_type_matches_numbers_request_body** -> post_number_type_matches_numbers_request_body(body) - ### Example @@ -7609,6 +7263,7 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import content_type_json_api +from unit_test_api.model.number_type_matches_numbers import NumberTypeMatchesNumbers from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -7622,7 +7277,7 @@ with unit_test_api.ApiClient(configuration) as api_client: api_instance = content_type_json_api.ContentTypeJsonApi(api_client) # example passing only required values which don't have defaults set - body = 3.14 + body = NumberTypeMatchesNumbers(3.14) try: api_response = api_instance.post_number_type_matches_numbers_request_body( body=body, @@ -7634,29 +7289,28 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_number_type_matches_numbers_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_number_type_matches_numbers_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**NumberTypeMatchesNumbers**](../../models/NumberTypeMatchesNumbers.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -decimal.Decimal, int, float, | decimal.Decimal, | | ### Return Types, Responses Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_number_type_matches_numbers_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_number_type_matches_numbers_request_body.response_for_200.ApiResponse) | success -#### post_number_type_matches_numbers_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -7671,8 +7325,6 @@ No authorization required # **post_number_type_matches_numbers_response_body_for_content_types** -> int, float post_number_type_matches_numbers_response_body_for_content_types() - ### Example @@ -7707,21 +7359,20 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_number_type_matches_numbers_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_number_type_matches_numbers_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_number_type_matches_numbers_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_number_type_matches_numbers_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**NumberTypeMatchesNumbers**](../../models/NumberTypeMatchesNumbers.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -decimal.Decimal, int, float, | decimal.Decimal, | | ### Authorization @@ -7731,8 +7382,6 @@ No authorization required # **post_object_properties_validation_request_body** -> post_object_properties_validation_request_body(object_properties_validation) - ### Example @@ -7766,15 +7415,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_object_properties_validation_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_object_properties_validation_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**ObjectPropertiesValidation**](../../models/ObjectPropertiesValidation.md) | | @@ -7785,9 +7434,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_object_properties_validation_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_object_properties_validation_request_body.response_for_200.ApiResponse) | success -#### post_object_properties_validation_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -7802,8 +7451,6 @@ No authorization required # **post_object_properties_validation_response_body_for_content_types** -> ObjectPropertiesValidation post_object_properties_validation_response_body_for_content_types() - ### Example @@ -7811,7 +7458,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import content_type_json_api -from unit_test_api.model.object_properties_validation import ObjectPropertiesValidation from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -7839,16 +7485,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_object_properties_validation_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_object_properties_validation_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_object_properties_validation_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_object_properties_validation_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**ObjectPropertiesValidation**](../../models/ObjectPropertiesValidation.md) | | @@ -7862,8 +7508,6 @@ No authorization required # **post_object_type_matches_objects_request_body** -> post_object_type_matches_objects_request_body(body) - ### Example @@ -7871,6 +7515,7 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import content_type_json_api +from unit_test_api.model.object_type_matches_objects import ObjectTypeMatchesObjects from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -7884,7 +7529,7 @@ with unit_test_api.ApiClient(configuration) as api_client: api_instance = content_type_json_api.ContentTypeJsonApi(api_client) # example passing only required values which don't have defaults set - body = dict() + body = ObjectTypeMatchesObjects() try: api_response = api_instance.post_object_type_matches_objects_request_body( body=body, @@ -7896,29 +7541,28 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_object_type_matches_objects_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_object_type_matches_objects_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**ObjectTypeMatchesObjects**](../../models/ObjectTypeMatchesObjects.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, | frozendict.frozendict, | | ### Return Types, Responses Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_object_type_matches_objects_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_object_type_matches_objects_request_body.response_for_200.ApiResponse) | success -#### post_object_type_matches_objects_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -7933,8 +7577,6 @@ No authorization required # **post_object_type_matches_objects_response_body_for_content_types** -> {str: (bool, date, datetime, dict, float, int, list, str, none_type)} post_object_type_matches_objects_response_body_for_content_types() - ### Example @@ -7969,21 +7611,20 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_object_type_matches_objects_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_object_type_matches_objects_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_object_type_matches_objects_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_object_type_matches_objects_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**ObjectTypeMatchesObjects**](../../models/ObjectTypeMatchesObjects.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, | frozendict.frozendict, | | ### Authorization @@ -7993,8 +7634,6 @@ No authorization required # **post_oneof_complex_types_request_body** -> post_oneof_complex_types_request_body(oneof_complex_types) - ### Example @@ -8028,15 +7667,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_oneof_complex_types_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_oneof_complex_types_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**OneofComplexTypes**](../../models/OneofComplexTypes.md) | | @@ -8047,9 +7686,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_oneof_complex_types_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_oneof_complex_types_request_body.response_for_200.ApiResponse) | success -#### post_oneof_complex_types_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -8064,8 +7703,6 @@ No authorization required # **post_oneof_complex_types_response_body_for_content_types** -> OneofComplexTypes post_oneof_complex_types_response_body_for_content_types() - ### Example @@ -8073,7 +7710,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import content_type_json_api -from unit_test_api.model.oneof_complex_types import OneofComplexTypes from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -8101,16 +7737,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_oneof_complex_types_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_oneof_complex_types_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_oneof_complex_types_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_oneof_complex_types_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**OneofComplexTypes**](../../models/OneofComplexTypes.md) | | @@ -8124,8 +7760,6 @@ No authorization required # **post_oneof_request_body** -> post_oneof_request_body(oneof) - ### Example @@ -8159,15 +7793,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_oneof_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_oneof_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**Oneof**](../../models/Oneof.md) | | @@ -8178,9 +7812,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_oneof_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_oneof_request_body.response_for_200.ApiResponse) | success -#### post_oneof_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -8195,8 +7829,6 @@ No authorization required # **post_oneof_response_body_for_content_types** -> Oneof post_oneof_response_body_for_content_types() - ### Example @@ -8204,7 +7836,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import content_type_json_api -from unit_test_api.model.oneof import Oneof from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -8232,16 +7863,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_oneof_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_oneof_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_oneof_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_oneof_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**Oneof**](../../models/Oneof.md) | | @@ -8255,8 +7886,6 @@ No authorization required # **post_oneof_with_base_schema_request_body** -> post_oneof_with_base_schema_request_body(body) - ### Example @@ -8290,15 +7919,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_oneof_with_base_schema_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_oneof_with_base_schema_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**OneofWithBaseSchema**](../../models/OneofWithBaseSchema.md) | | @@ -8309,9 +7938,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_oneof_with_base_schema_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_oneof_with_base_schema_request_body.response_for_200.ApiResponse) | success -#### post_oneof_with_base_schema_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -8326,8 +7955,6 @@ No authorization required # **post_oneof_with_base_schema_response_body_for_content_types** -> OneofWithBaseSchema post_oneof_with_base_schema_response_body_for_content_types() - ### Example @@ -8335,7 +7962,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import content_type_json_api -from unit_test_api.model.oneof_with_base_schema import OneofWithBaseSchema from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -8363,16 +7989,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_oneof_with_base_schema_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_oneof_with_base_schema_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_oneof_with_base_schema_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_oneof_with_base_schema_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**OneofWithBaseSchema**](../../models/OneofWithBaseSchema.md) | | @@ -8386,8 +8012,6 @@ No authorization required # **post_oneof_with_empty_schema_request_body** -> post_oneof_with_empty_schema_request_body(oneof_with_empty_schema) - ### Example @@ -8421,15 +8045,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_oneof_with_empty_schema_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_oneof_with_empty_schema_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**OneofWithEmptySchema**](../../models/OneofWithEmptySchema.md) | | @@ -8440,9 +8064,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_oneof_with_empty_schema_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_oneof_with_empty_schema_request_body.response_for_200.ApiResponse) | success -#### post_oneof_with_empty_schema_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -8457,8 +8081,6 @@ No authorization required # **post_oneof_with_empty_schema_response_body_for_content_types** -> OneofWithEmptySchema post_oneof_with_empty_schema_response_body_for_content_types() - ### Example @@ -8466,7 +8088,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import content_type_json_api -from unit_test_api.model.oneof_with_empty_schema import OneofWithEmptySchema from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -8494,16 +8115,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_oneof_with_empty_schema_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_oneof_with_empty_schema_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_oneof_with_empty_schema_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_oneof_with_empty_schema_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**OneofWithEmptySchema**](../../models/OneofWithEmptySchema.md) | | @@ -8517,8 +8138,6 @@ No authorization required # **post_oneof_with_required_request_body** -> post_oneof_with_required_request_body(oneof_with_required) - ### Example @@ -8552,15 +8171,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_oneof_with_required_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_oneof_with_required_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**OneofWithRequired**](../../models/OneofWithRequired.md) | | @@ -8571,9 +8190,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_oneof_with_required_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_oneof_with_required_request_body.response_for_200.ApiResponse) | success -#### post_oneof_with_required_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -8588,8 +8207,6 @@ No authorization required # **post_oneof_with_required_response_body_for_content_types** -> OneofWithRequired post_oneof_with_required_response_body_for_content_types() - ### Example @@ -8597,7 +8214,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import content_type_json_api -from unit_test_api.model.oneof_with_required import OneofWithRequired from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -8625,16 +8241,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_oneof_with_required_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_oneof_with_required_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_oneof_with_required_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_oneof_with_required_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**OneofWithRequired**](../../models/OneofWithRequired.md) | | @@ -8648,8 +8264,6 @@ No authorization required # **post_pattern_is_not_anchored_request_body** -> post_pattern_is_not_anchored_request_body(body) - ### Example @@ -8683,15 +8297,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_pattern_is_not_anchored_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_pattern_is_not_anchored_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**PatternIsNotAnchored**](../../models/PatternIsNotAnchored.md) | | @@ -8702,9 +8316,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_pattern_is_not_anchored_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_pattern_is_not_anchored_request_body.response_for_200.ApiResponse) | success -#### post_pattern_is_not_anchored_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -8719,8 +8333,6 @@ No authorization required # **post_pattern_is_not_anchored_response_body_for_content_types** -> PatternIsNotAnchored post_pattern_is_not_anchored_response_body_for_content_types() - ### Example @@ -8728,7 +8340,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import content_type_json_api -from unit_test_api.model.pattern_is_not_anchored import PatternIsNotAnchored from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -8756,16 +8367,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_pattern_is_not_anchored_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_pattern_is_not_anchored_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_pattern_is_not_anchored_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_pattern_is_not_anchored_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**PatternIsNotAnchored**](../../models/PatternIsNotAnchored.md) | | @@ -8779,8 +8390,6 @@ No authorization required # **post_pattern_validation_request_body** -> post_pattern_validation_request_body(body) - ### Example @@ -8814,15 +8423,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_pattern_validation_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_pattern_validation_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**PatternValidation**](../../models/PatternValidation.md) | | @@ -8833,9 +8442,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_pattern_validation_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_pattern_validation_request_body.response_for_200.ApiResponse) | success -#### post_pattern_validation_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -8850,8 +8459,6 @@ No authorization required # **post_pattern_validation_response_body_for_content_types** -> PatternValidation post_pattern_validation_response_body_for_content_types() - ### Example @@ -8859,7 +8466,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import content_type_json_api -from unit_test_api.model.pattern_validation import PatternValidation from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -8887,16 +8493,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_pattern_validation_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_pattern_validation_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_pattern_validation_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_pattern_validation_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**PatternValidation**](../../models/PatternValidation.md) | | @@ -8910,8 +8516,6 @@ No authorization required # **post_properties_with_escaped_characters_request_body** -> post_properties_with_escaped_characters_request_body(properties_with_escaped_characters) - ### Example @@ -8945,15 +8549,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_properties_with_escaped_characters_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_properties_with_escaped_characters_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**PropertiesWithEscapedCharacters**](../../models/PropertiesWithEscapedCharacters.md) | | @@ -8964,9 +8568,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_properties_with_escaped_characters_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_properties_with_escaped_characters_request_body.response_for_200.ApiResponse) | success -#### post_properties_with_escaped_characters_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -8981,8 +8585,6 @@ No authorization required # **post_properties_with_escaped_characters_response_body_for_content_types** -> PropertiesWithEscapedCharacters post_properties_with_escaped_characters_response_body_for_content_types() - ### Example @@ -8990,7 +8592,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import content_type_json_api -from unit_test_api.model.properties_with_escaped_characters import PropertiesWithEscapedCharacters from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -9018,16 +8619,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_properties_with_escaped_characters_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_properties_with_escaped_characters_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_properties_with_escaped_characters_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_properties_with_escaped_characters_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**PropertiesWithEscapedCharacters**](../../models/PropertiesWithEscapedCharacters.md) | | @@ -9041,8 +8642,6 @@ No authorization required # **post_property_named_ref_that_is_not_a_reference_request_body** -> post_property_named_ref_that_is_not_a_reference_request_body(property_named_ref_that_is_not_a_reference) - ### Example @@ -9076,15 +8675,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_property_named_ref_that_is_not_a_reference_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_property_named_ref_that_is_not_a_reference_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**PropertyNamedRefThatIsNotAReference**](../../models/PropertyNamedRefThatIsNotAReference.md) | | @@ -9095,9 +8694,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_property_named_ref_that_is_not_a_reference_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_property_named_ref_that_is_not_a_reference_request_body.response_for_200.ApiResponse) | success -#### post_property_named_ref_that_is_not_a_reference_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -9112,8 +8711,6 @@ No authorization required # **post_property_named_ref_that_is_not_a_reference_response_body_for_content_types** -> PropertyNamedRefThatIsNotAReference post_property_named_ref_that_is_not_a_reference_response_body_for_content_types() - ### Example @@ -9121,7 +8718,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import content_type_json_api -from unit_test_api.model.property_named_ref_that_is_not_a_reference import PropertyNamedRefThatIsNotAReference from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -9149,16 +8745,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_property_named_ref_that_is_not_a_reference_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_property_named_ref_that_is_not_a_reference_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_property_named_ref_that_is_not_a_reference_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_property_named_ref_that_is_not_a_reference_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**PropertyNamedRefThatIsNotAReference**](../../models/PropertyNamedRefThatIsNotAReference.md) | | @@ -9172,8 +8768,6 @@ No authorization required # **post_ref_in_additionalproperties_request_body** -> post_ref_in_additionalproperties_request_body(ref_in_additionalproperties) - ### Example @@ -9209,15 +8803,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_ref_in_additionalproperties_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_ref_in_additionalproperties_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**RefInAdditionalproperties**](../../models/RefInAdditionalproperties.md) | | @@ -9228,9 +8822,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_ref_in_additionalproperties_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_ref_in_additionalproperties_request_body.response_for_200.ApiResponse) | success -#### post_ref_in_additionalproperties_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -9245,8 +8839,6 @@ No authorization required # **post_ref_in_additionalproperties_response_body_for_content_types** -> RefInAdditionalproperties post_ref_in_additionalproperties_response_body_for_content_types() - ### Example @@ -9254,7 +8846,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import content_type_json_api -from unit_test_api.model.ref_in_additionalproperties import RefInAdditionalproperties from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -9282,16 +8873,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_ref_in_additionalproperties_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_ref_in_additionalproperties_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_ref_in_additionalproperties_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_ref_in_additionalproperties_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**RefInAdditionalproperties**](../../models/RefInAdditionalproperties.md) | | @@ -9305,8 +8896,6 @@ No authorization required # **post_ref_in_allof_request_body** -> post_ref_in_allof_request_body(ref_in_allof) - ### Example @@ -9340,15 +8929,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_ref_in_allof_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_ref_in_allof_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**RefInAllof**](../../models/RefInAllof.md) | | @@ -9359,9 +8948,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_ref_in_allof_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_ref_in_allof_request_body.response_for_200.ApiResponse) | success -#### post_ref_in_allof_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -9376,8 +8965,6 @@ No authorization required # **post_ref_in_allof_response_body_for_content_types** -> RefInAllof post_ref_in_allof_response_body_for_content_types() - ### Example @@ -9385,7 +8972,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import content_type_json_api -from unit_test_api.model.ref_in_allof import RefInAllof from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -9413,16 +8999,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_ref_in_allof_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_ref_in_allof_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_ref_in_allof_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_ref_in_allof_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**RefInAllof**](../../models/RefInAllof.md) | | @@ -9436,8 +9022,6 @@ No authorization required # **post_ref_in_anyof_request_body** -> post_ref_in_anyof_request_body(ref_in_anyof) - ### Example @@ -9471,15 +9055,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_ref_in_anyof_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_ref_in_anyof_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**RefInAnyof**](../../models/RefInAnyof.md) | | @@ -9490,9 +9074,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_ref_in_anyof_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_ref_in_anyof_request_body.response_for_200.ApiResponse) | success -#### post_ref_in_anyof_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -9507,8 +9091,6 @@ No authorization required # **post_ref_in_anyof_response_body_for_content_types** -> RefInAnyof post_ref_in_anyof_response_body_for_content_types() - ### Example @@ -9516,7 +9098,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import content_type_json_api -from unit_test_api.model.ref_in_anyof import RefInAnyof from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -9544,16 +9125,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_ref_in_anyof_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_ref_in_anyof_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_ref_in_anyof_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_ref_in_anyof_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**RefInAnyof**](../../models/RefInAnyof.md) | | @@ -9567,8 +9148,6 @@ No authorization required # **post_ref_in_items_request_body** -> post_ref_in_items_request_body(ref_in_items) - ### Example @@ -9604,15 +9183,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_ref_in_items_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_ref_in_items_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**RefInItems**](../../models/RefInItems.md) | | @@ -9623,9 +9202,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_ref_in_items_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_ref_in_items_request_body.response_for_200.ApiResponse) | success -#### post_ref_in_items_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -9640,8 +9219,6 @@ No authorization required # **post_ref_in_items_response_body_for_content_types** -> RefInItems post_ref_in_items_response_body_for_content_types() - ### Example @@ -9649,7 +9226,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import content_type_json_api -from unit_test_api.model.ref_in_items import RefInItems from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -9677,16 +9253,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_ref_in_items_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_ref_in_items_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_ref_in_items_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_ref_in_items_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**RefInItems**](../../models/RefInItems.md) | | @@ -9700,8 +9276,6 @@ No authorization required # **post_ref_in_not_request_body** -> post_ref_in_not_request_body(body) - ### Example @@ -9709,7 +9283,7 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import content_type_json_api -from unit_test_api.model.property_named_ref_that_is_not_a_reference import PropertyNamedRefThatIsNotAReference +from unit_test_api.model.ref_in_not import RefInNot from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -9723,7 +9297,7 @@ with unit_test_api.ApiClient(configuration) as api_client: api_instance = content_type_json_api.ContentTypeJsonApi(api_client) # example passing only required values which don't have defaults set - body = None + body = RefInNot(None) try: api_response = api_instance.post_ref_in_not_request_body( body=body, @@ -9735,35 +9309,28 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_ref_in_not_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_ref_in_not_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson - -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, | frozendict.frozendict, str, decimal.Decimal, BoolClass, NoneClass, tuple, bytes, FileIO | | +# RequestBody.Schemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**RefInNot**](../../models/RefInNot.md) | | -### Composed Schemas (allOf/anyOf/oneOf/not) -#### not -Class Name | Input Type | Accessed Type | Description | Notes -------------- | ------------- | ------------- | ------------- | ------------- -[PropertyNamedRefThatIsNotAReference]({{complexTypePrefix}}PropertyNamedRefThatIsNotAReference.md) | [**PropertyNamedRefThatIsNotAReference**]({{complexTypePrefix}}PropertyNamedRefThatIsNotAReference.md) | [**PropertyNamedRefThatIsNotAReference**]({{complexTypePrefix}}PropertyNamedRefThatIsNotAReference.md) | | ### Return Types, Responses Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_ref_in_not_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_ref_in_not_request_body.response_for_200.ApiResponse) | success -#### post_ref_in_not_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -9778,8 +9345,6 @@ No authorization required # **post_ref_in_not_response_body_for_content_types** -> bool, date, datetime, dict, float, int, list, str, none_type post_ref_in_not_response_body_for_content_types() - ### Example @@ -9787,7 +9352,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import content_type_json_api -from unit_test_api.model.property_named_ref_that_is_not_a_reference import PropertyNamedRefThatIsNotAReference from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -9815,27 +9379,20 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_ref_in_not_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_ref_in_not_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_ref_in_not_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_ref_in_not_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson - -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, | frozendict.frozendict, str, decimal.Decimal, BoolClass, NoneClass, tuple, bytes, FileIO | | +# response_for_200.BodySchemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**RefInNot**](../../models/RefInNot.md) | | -### Composed Schemas (allOf/anyOf/oneOf/not) -#### not -Class Name | Input Type | Accessed Type | Description | Notes -------------- | ------------- | ------------- | ------------- | ------------- -[PropertyNamedRefThatIsNotAReference]({{complexTypePrefix}}PropertyNamedRefThatIsNotAReference.md) | [**PropertyNamedRefThatIsNotAReference**]({{complexTypePrefix}}PropertyNamedRefThatIsNotAReference.md) | [**PropertyNamedRefThatIsNotAReference**]({{complexTypePrefix}}PropertyNamedRefThatIsNotAReference.md) | | ### Authorization @@ -9845,8 +9402,6 @@ No authorization required # **post_ref_in_oneof_request_body** -> post_ref_in_oneof_request_body(ref_in_oneof) - ### Example @@ -9880,15 +9435,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_ref_in_oneof_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_ref_in_oneof_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**RefInOneof**](../../models/RefInOneof.md) | | @@ -9899,9 +9454,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_ref_in_oneof_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_ref_in_oneof_request_body.response_for_200.ApiResponse) | success -#### post_ref_in_oneof_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -9916,8 +9471,6 @@ No authorization required # **post_ref_in_oneof_response_body_for_content_types** -> RefInOneof post_ref_in_oneof_response_body_for_content_types() - ### Example @@ -9925,7 +9478,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import content_type_json_api -from unit_test_api.model.ref_in_oneof import RefInOneof from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -9953,16 +9505,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_ref_in_oneof_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_ref_in_oneof_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_ref_in_oneof_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_ref_in_oneof_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**RefInOneof**](../../models/RefInOneof.md) | | @@ -9976,8 +9528,6 @@ No authorization required # **post_ref_in_property_request_body** -> post_ref_in_property_request_body(ref_in_property) - ### Example @@ -10011,15 +9561,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_ref_in_property_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_ref_in_property_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**RefInProperty**](../../models/RefInProperty.md) | | @@ -10030,9 +9580,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_ref_in_property_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_ref_in_property_request_body.response_for_200.ApiResponse) | success -#### post_ref_in_property_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -10047,8 +9597,6 @@ No authorization required # **post_ref_in_property_response_body_for_content_types** -> RefInProperty post_ref_in_property_response_body_for_content_types() - ### Example @@ -10056,7 +9604,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import content_type_json_api -from unit_test_api.model.ref_in_property import RefInProperty from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -10084,16 +9631,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_ref_in_property_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_ref_in_property_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_ref_in_property_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_ref_in_property_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**RefInProperty**](../../models/RefInProperty.md) | | @@ -10107,8 +9654,6 @@ No authorization required # **post_required_default_validation_request_body** -> post_required_default_validation_request_body(required_default_validation) - ### Example @@ -10142,15 +9687,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_required_default_validation_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_required_default_validation_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**RequiredDefaultValidation**](../../models/RequiredDefaultValidation.md) | | @@ -10161,9 +9706,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_required_default_validation_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_required_default_validation_request_body.response_for_200.ApiResponse) | success -#### post_required_default_validation_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -10178,8 +9723,6 @@ No authorization required # **post_required_default_validation_response_body_for_content_types** -> RequiredDefaultValidation post_required_default_validation_response_body_for_content_types() - ### Example @@ -10187,7 +9730,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import content_type_json_api -from unit_test_api.model.required_default_validation import RequiredDefaultValidation from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -10215,16 +9757,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_required_default_validation_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_required_default_validation_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_required_default_validation_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_required_default_validation_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**RequiredDefaultValidation**](../../models/RequiredDefaultValidation.md) | | @@ -10238,8 +9780,6 @@ No authorization required # **post_required_validation_request_body** -> post_required_validation_request_body(required_validation) - ### Example @@ -10273,15 +9813,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_required_validation_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_required_validation_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**RequiredValidation**](../../models/RequiredValidation.md) | | @@ -10292,9 +9832,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_required_validation_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_required_validation_request_body.response_for_200.ApiResponse) | success -#### post_required_validation_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -10309,8 +9849,6 @@ No authorization required # **post_required_validation_response_body_for_content_types** -> RequiredValidation post_required_validation_response_body_for_content_types() - ### Example @@ -10318,7 +9856,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import content_type_json_api -from unit_test_api.model.required_validation import RequiredValidation from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -10346,16 +9883,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_required_validation_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_required_validation_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_required_validation_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_required_validation_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**RequiredValidation**](../../models/RequiredValidation.md) | | @@ -10369,8 +9906,6 @@ No authorization required # **post_required_with_empty_array_request_body** -> post_required_with_empty_array_request_body(required_with_empty_array) - ### Example @@ -10404,15 +9939,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_required_with_empty_array_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_required_with_empty_array_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**RequiredWithEmptyArray**](../../models/RequiredWithEmptyArray.md) | | @@ -10423,9 +9958,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_required_with_empty_array_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_required_with_empty_array_request_body.response_for_200.ApiResponse) | success -#### post_required_with_empty_array_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -10440,8 +9975,6 @@ No authorization required # **post_required_with_empty_array_response_body_for_content_types** -> RequiredWithEmptyArray post_required_with_empty_array_response_body_for_content_types() - ### Example @@ -10449,7 +9982,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import content_type_json_api -from unit_test_api.model.required_with_empty_array import RequiredWithEmptyArray from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -10477,16 +10009,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_required_with_empty_array_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_required_with_empty_array_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_required_with_empty_array_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_required_with_empty_array_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**RequiredWithEmptyArray**](../../models/RequiredWithEmptyArray.md) | | @@ -10500,8 +10032,6 @@ No authorization required # **post_required_with_escaped_characters_request_body** -> post_required_with_escaped_characters_request_body(body) - ### Example @@ -10509,6 +10039,7 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import content_type_json_api +from unit_test_api.model.required_with_escaped_characters import RequiredWithEscapedCharacters from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -10522,7 +10053,7 @@ with unit_test_api.ApiClient(configuration) as api_client: api_instance = content_type_json_api.ContentTypeJsonApi(api_client) # example passing only required values which don't have defaults set - body = None + body = RequiredWithEscapedCharacters(None) try: api_response = api_instance.post_required_with_escaped_characters_request_body( body=body, @@ -10534,29 +10065,28 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_required_with_escaped_characters_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_required_with_escaped_characters_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**RequiredWithEscapedCharacters**](../../models/RequiredWithEscapedCharacters.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, | frozendict.frozendict, str, decimal.Decimal, BoolClass, NoneClass, tuple, bytes, FileIO | | ### Return Types, Responses Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_required_with_escaped_characters_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_required_with_escaped_characters_request_body.response_for_200.ApiResponse) | success -#### post_required_with_escaped_characters_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -10571,8 +10101,6 @@ No authorization required # **post_required_with_escaped_characters_response_body_for_content_types** -> bool, date, datetime, dict, float, int, list, str, none_type post_required_with_escaped_characters_response_body_for_content_types() - ### Example @@ -10607,21 +10135,20 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_required_with_escaped_characters_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_required_with_escaped_characters_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_required_with_escaped_characters_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_required_with_escaped_characters_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**RequiredWithEscapedCharacters**](../../models/RequiredWithEscapedCharacters.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, | frozendict.frozendict, str, decimal.Decimal, BoolClass, NoneClass, tuple, bytes, FileIO | | ### Authorization @@ -10631,8 +10158,6 @@ No authorization required # **post_simple_enum_validation_request_body** -> post_simple_enum_validation_request_body(body) - ### Example @@ -10666,15 +10191,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_simple_enum_validation_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_simple_enum_validation_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**SimpleEnumValidation**](../../models/SimpleEnumValidation.md) | | @@ -10685,9 +10210,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_simple_enum_validation_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_simple_enum_validation_request_body.response_for_200.ApiResponse) | success -#### post_simple_enum_validation_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -10702,8 +10227,6 @@ No authorization required # **post_simple_enum_validation_response_body_for_content_types** -> SimpleEnumValidation post_simple_enum_validation_response_body_for_content_types() - ### Example @@ -10711,7 +10234,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import content_type_json_api -from unit_test_api.model.simple_enum_validation import SimpleEnumValidation from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -10739,16 +10261,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_simple_enum_validation_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_simple_enum_validation_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_simple_enum_validation_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_simple_enum_validation_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**SimpleEnumValidation**](../../models/SimpleEnumValidation.md) | | @@ -10762,8 +10284,6 @@ No authorization required # **post_string_type_matches_strings_request_body** -> post_string_type_matches_strings_request_body(body) - ### Example @@ -10771,6 +10291,7 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import content_type_json_api +from unit_test_api.model.string_type_matches_strings import StringTypeMatchesStrings from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -10784,7 +10305,7 @@ with unit_test_api.ApiClient(configuration) as api_client: api_instance = content_type_json_api.ContentTypeJsonApi(api_client) # example passing only required values which don't have defaults set - body = "body_example" + body = StringTypeMatchesStrings("body_example") try: api_response = api_instance.post_string_type_matches_strings_request_body( body=body, @@ -10796,29 +10317,28 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_string_type_matches_strings_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_string_type_matches_strings_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**StringTypeMatchesStrings**](../../models/StringTypeMatchesStrings.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -str, | str, | | ### Return Types, Responses Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_string_type_matches_strings_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_string_type_matches_strings_request_body.response_for_200.ApiResponse) | success -#### post_string_type_matches_strings_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -10833,8 +10353,6 @@ No authorization required # **post_string_type_matches_strings_response_body_for_content_types** -> str post_string_type_matches_strings_response_body_for_content_types() - ### Example @@ -10869,21 +10387,20 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_string_type_matches_strings_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_string_type_matches_strings_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_string_type_matches_strings_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_string_type_matches_strings_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**StringTypeMatchesStrings**](../../models/StringTypeMatchesStrings.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -str, | str, | | ### Authorization @@ -10893,8 +10410,6 @@ No authorization required # **post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_request_body** -> post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_request_body(the_default_keyword_does_not_do_anything_if_the_property_is_missing) - ### Example @@ -10930,15 +10445,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing**](../../models/TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.md) | | @@ -10949,9 +10464,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_request_body.response_for_200.ApiResponse) | success -#### post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -10966,8 +10481,6 @@ No authorization required # **post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_response_body_for_content_types** -> TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_response_body_for_content_types() - ### Example @@ -10975,7 +10488,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import content_type_json_api -from unit_test_api.model.the_default_keyword_does_not_do_anything_if_the_property_is_missing import TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -11003,16 +10515,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing**](../../models/TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.md) | | @@ -11026,8 +10538,6 @@ No authorization required # **post_uniqueitems_false_validation_request_body** -> post_uniqueitems_false_validation_request_body(body) - ### Example @@ -11061,15 +10571,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_uniqueitems_false_validation_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_uniqueitems_false_validation_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**UniqueitemsFalseValidation**](../../models/UniqueitemsFalseValidation.md) | | @@ -11080,9 +10590,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_uniqueitems_false_validation_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_uniqueitems_false_validation_request_body.response_for_200.ApiResponse) | success -#### post_uniqueitems_false_validation_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -11097,8 +10607,6 @@ No authorization required # **post_uniqueitems_false_validation_response_body_for_content_types** -> UniqueitemsFalseValidation post_uniqueitems_false_validation_response_body_for_content_types() - ### Example @@ -11106,7 +10614,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import content_type_json_api -from unit_test_api.model.uniqueitems_false_validation import UniqueitemsFalseValidation from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -11134,16 +10641,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_uniqueitems_false_validation_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_uniqueitems_false_validation_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_uniqueitems_false_validation_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_uniqueitems_false_validation_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**UniqueitemsFalseValidation**](../../models/UniqueitemsFalseValidation.md) | | @@ -11157,8 +10664,6 @@ No authorization required # **post_uniqueitems_validation_request_body** -> post_uniqueitems_validation_request_body(body) - ### Example @@ -11192,15 +10697,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_uniqueitems_validation_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_uniqueitems_validation_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**UniqueitemsValidation**](../../models/UniqueitemsValidation.md) | | @@ -11211,9 +10716,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_uniqueitems_validation_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_uniqueitems_validation_request_body.response_for_200.ApiResponse) | success -#### post_uniqueitems_validation_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -11228,8 +10733,6 @@ No authorization required # **post_uniqueitems_validation_response_body_for_content_types** -> UniqueitemsValidation post_uniqueitems_validation_response_body_for_content_types() - ### Example @@ -11237,7 +10740,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import content_type_json_api -from unit_test_api.model.uniqueitems_validation import UniqueitemsValidation from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -11265,16 +10767,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_uniqueitems_validation_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_uniqueitems_validation_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_uniqueitems_validation_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_uniqueitems_validation_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**UniqueitemsValidation**](../../models/UniqueitemsValidation.md) | | @@ -11288,8 +10790,6 @@ No authorization required # **post_uri_format_request_body** -> post_uri_format_request_body(body) - ### Example @@ -11297,6 +10797,7 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import content_type_json_api +from unit_test_api.model.uri_format import UriFormat from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -11310,7 +10811,7 @@ with unit_test_api.ApiClient(configuration) as api_client: api_instance = content_type_json_api.ContentTypeJsonApi(api_client) # example passing only required values which don't have defaults set - body = None + body = UriFormat(None) try: api_response = api_instance.post_uri_format_request_body( body=body, @@ -11322,29 +10823,28 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_uri_format_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_uri_format_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**UriFormat**](../../models/UriFormat.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, | frozendict.frozendict, str, decimal.Decimal, BoolClass, NoneClass, tuple, bytes, FileIO | | ### Return Types, Responses Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_uri_format_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_uri_format_request_body.response_for_200.ApiResponse) | success -#### post_uri_format_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -11359,8 +10859,6 @@ No authorization required # **post_uri_format_response_body_for_content_types** -> bool, date, datetime, dict, float, int, list, str, none_type post_uri_format_response_body_for_content_types() - ### Example @@ -11395,21 +10893,20 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_uri_format_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_uri_format_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_uri_format_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_uri_format_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**UriFormat**](../../models/UriFormat.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, | frozendict.frozendict, str, decimal.Decimal, BoolClass, NoneClass, tuple, bytes, FileIO | | ### Authorization @@ -11419,8 +10916,6 @@ No authorization required # **post_uri_reference_format_request_body** -> post_uri_reference_format_request_body(body) - ### Example @@ -11428,6 +10923,7 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import content_type_json_api +from unit_test_api.model.uri_reference_format import UriReferenceFormat from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -11441,7 +10937,7 @@ with unit_test_api.ApiClient(configuration) as api_client: api_instance = content_type_json_api.ContentTypeJsonApi(api_client) # example passing only required values which don't have defaults set - body = None + body = UriReferenceFormat(None) try: api_response = api_instance.post_uri_reference_format_request_body( body=body, @@ -11453,29 +10949,28 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_uri_reference_format_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_uri_reference_format_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**UriReferenceFormat**](../../models/UriReferenceFormat.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, | frozendict.frozendict, str, decimal.Decimal, BoolClass, NoneClass, tuple, bytes, FileIO | | ### Return Types, Responses Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_uri_reference_format_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_uri_reference_format_request_body.response_for_200.ApiResponse) | success -#### post_uri_reference_format_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -11490,8 +10985,6 @@ No authorization required # **post_uri_reference_format_response_body_for_content_types** -> bool, date, datetime, dict, float, int, list, str, none_type post_uri_reference_format_response_body_for_content_types() - ### Example @@ -11526,21 +11019,20 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_uri_reference_format_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_uri_reference_format_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_uri_reference_format_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_uri_reference_format_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**UriReferenceFormat**](../../models/UriReferenceFormat.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, | frozendict.frozendict, str, decimal.Decimal, BoolClass, NoneClass, tuple, bytes, FileIO | | ### Authorization @@ -11550,8 +11042,6 @@ No authorization required # **post_uri_template_format_request_body** -> post_uri_template_format_request_body(body) - ### Example @@ -11559,6 +11049,7 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import content_type_json_api +from unit_test_api.model.uri_template_format import UriTemplateFormat from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -11572,7 +11063,7 @@ with unit_test_api.ApiClient(configuration) as api_client: api_instance = content_type_json_api.ContentTypeJsonApi(api_client) # example passing only required values which don't have defaults set - body = None + body = UriTemplateFormat(None) try: api_response = api_instance.post_uri_template_format_request_body( body=body, @@ -11584,29 +11075,28 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_uri_template_format_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_uri_template_format_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**UriTemplateFormat**](../../models/UriTemplateFormat.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, | frozendict.frozendict, str, decimal.Decimal, BoolClass, NoneClass, tuple, bytes, FileIO | | ### Return Types, Responses Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_uri_template_format_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_uri_template_format_request_body.response_for_200.ApiResponse) | success -#### post_uri_template_format_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -11621,8 +11111,6 @@ No authorization required # **post_uri_template_format_response_body_for_content_types** -> bool, date, datetime, dict, float, int, list, str, none_type post_uri_template_format_response_body_for_content_types() - ### Example @@ -11657,21 +11145,20 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_uri_template_format_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_uri_template_format_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_uri_template_format_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_uri_template_format_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**UriTemplateFormat**](../../models/UriTemplateFormat.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, | frozendict.frozendict, str, decimal.Decimal, BoolClass, NoneClass, tuple, bytes, FileIO | | ### Authorization diff --git a/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/DefaultApi.md b/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/DefaultApi.md index 4fb214ed39a..3670142f4d8 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/DefaultApi.md +++ b/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/DefaultApi.md @@ -12,8 +12,6 @@ Method | HTTP request | Description # **post_invalid_string_value_for_default_request_body** -> post_invalid_string_value_for_default_request_body(invalid_string_value_for_default) - ### Example @@ -47,15 +45,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_invalid_string_value_for_default_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_invalid_string_value_for_default_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**InvalidStringValueForDefault**](../../models/InvalidStringValueForDefault.md) | | @@ -66,9 +64,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_invalid_string_value_for_default_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_invalid_string_value_for_default_request_body.response_for_200.ApiResponse) | success -#### post_invalid_string_value_for_default_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -83,8 +81,6 @@ No authorization required # **post_invalid_string_value_for_default_response_body_for_content_types** -> InvalidStringValueForDefault post_invalid_string_value_for_default_response_body_for_content_types() - ### Example @@ -92,7 +88,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import default_api -from unit_test_api.model.invalid_string_value_for_default import InvalidStringValueForDefault from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -120,16 +115,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_invalid_string_value_for_default_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_invalid_string_value_for_default_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_invalid_string_value_for_default_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_invalid_string_value_for_default_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**InvalidStringValueForDefault**](../../models/InvalidStringValueForDefault.md) | | @@ -143,8 +138,6 @@ No authorization required # **post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_request_body** -> post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_request_body(the_default_keyword_does_not_do_anything_if_the_property_is_missing) - ### Example @@ -180,15 +173,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing**](../../models/TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.md) | | @@ -199,9 +192,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_request_body.response_for_200.ApiResponse) | success -#### post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -216,8 +209,6 @@ No authorization required # **post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_response_body_for_content_types** -> TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_response_body_for_content_types() - ### Example @@ -225,7 +216,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import default_api -from unit_test_api.model.the_default_keyword_does_not_do_anything_if_the_property_is_missing import TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -253,16 +243,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing**](../../models/TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.md) | | diff --git a/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/EnumApi.md b/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/EnumApi.md index ec345869090..b0635858e00 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/EnumApi.md +++ b/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/EnumApi.md @@ -24,8 +24,6 @@ Method | HTTP request | Description # **post_enum_with0_does_not_match_false_request_body** -> post_enum_with0_does_not_match_false_request_body(body) - ### Example @@ -59,15 +57,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_enum_with0_does_not_match_false_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_enum_with0_does_not_match_false_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**EnumWith0DoesNotMatchFalse**](../../models/EnumWith0DoesNotMatchFalse.md) | | @@ -78,9 +76,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_enum_with0_does_not_match_false_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_enum_with0_does_not_match_false_request_body.response_for_200.ApiResponse) | success -#### post_enum_with0_does_not_match_false_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -95,8 +93,6 @@ No authorization required # **post_enum_with0_does_not_match_false_response_body_for_content_types** -> EnumWith0DoesNotMatchFalse post_enum_with0_does_not_match_false_response_body_for_content_types() - ### Example @@ -104,7 +100,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import enum_api -from unit_test_api.model.enum_with0_does_not_match_false import EnumWith0DoesNotMatchFalse from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -132,16 +127,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_enum_with0_does_not_match_false_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_enum_with0_does_not_match_false_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_enum_with0_does_not_match_false_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_enum_with0_does_not_match_false_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**EnumWith0DoesNotMatchFalse**](../../models/EnumWith0DoesNotMatchFalse.md) | | @@ -155,8 +150,6 @@ No authorization required # **post_enum_with1_does_not_match_true_request_body** -> post_enum_with1_does_not_match_true_request_body(body) - ### Example @@ -190,15 +183,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_enum_with1_does_not_match_true_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_enum_with1_does_not_match_true_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**EnumWith1DoesNotMatchTrue**](../../models/EnumWith1DoesNotMatchTrue.md) | | @@ -209,9 +202,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_enum_with1_does_not_match_true_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_enum_with1_does_not_match_true_request_body.response_for_200.ApiResponse) | success -#### post_enum_with1_does_not_match_true_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -226,8 +219,6 @@ No authorization required # **post_enum_with1_does_not_match_true_response_body_for_content_types** -> EnumWith1DoesNotMatchTrue post_enum_with1_does_not_match_true_response_body_for_content_types() - ### Example @@ -235,7 +226,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import enum_api -from unit_test_api.model.enum_with1_does_not_match_true import EnumWith1DoesNotMatchTrue from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -263,16 +253,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_enum_with1_does_not_match_true_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_enum_with1_does_not_match_true_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_enum_with1_does_not_match_true_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_enum_with1_does_not_match_true_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**EnumWith1DoesNotMatchTrue**](../../models/EnumWith1DoesNotMatchTrue.md) | | @@ -286,8 +276,6 @@ No authorization required # **post_enum_with_escaped_characters_request_body** -> post_enum_with_escaped_characters_request_body(body) - ### Example @@ -321,15 +309,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_enum_with_escaped_characters_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_enum_with_escaped_characters_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**EnumWithEscapedCharacters**](../../models/EnumWithEscapedCharacters.md) | | @@ -340,9 +328,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_enum_with_escaped_characters_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_enum_with_escaped_characters_request_body.response_for_200.ApiResponse) | success -#### post_enum_with_escaped_characters_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -357,8 +345,6 @@ No authorization required # **post_enum_with_escaped_characters_response_body_for_content_types** -> EnumWithEscapedCharacters post_enum_with_escaped_characters_response_body_for_content_types() - ### Example @@ -366,7 +352,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import enum_api -from unit_test_api.model.enum_with_escaped_characters import EnumWithEscapedCharacters from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -394,16 +379,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_enum_with_escaped_characters_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_enum_with_escaped_characters_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_enum_with_escaped_characters_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_enum_with_escaped_characters_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**EnumWithEscapedCharacters**](../../models/EnumWithEscapedCharacters.md) | | @@ -417,8 +402,6 @@ No authorization required # **post_enum_with_false_does_not_match0_request_body** -> post_enum_with_false_does_not_match0_request_body(body) - ### Example @@ -452,15 +435,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_enum_with_false_does_not_match0_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_enum_with_false_does_not_match0_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**EnumWithFalseDoesNotMatch0**](../../models/EnumWithFalseDoesNotMatch0.md) | | @@ -471,9 +454,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_enum_with_false_does_not_match0_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_enum_with_false_does_not_match0_request_body.response_for_200.ApiResponse) | success -#### post_enum_with_false_does_not_match0_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -488,8 +471,6 @@ No authorization required # **post_enum_with_false_does_not_match0_response_body_for_content_types** -> EnumWithFalseDoesNotMatch0 post_enum_with_false_does_not_match0_response_body_for_content_types() - ### Example @@ -497,7 +478,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import enum_api -from unit_test_api.model.enum_with_false_does_not_match0 import EnumWithFalseDoesNotMatch0 from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -525,16 +505,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_enum_with_false_does_not_match0_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_enum_with_false_does_not_match0_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_enum_with_false_does_not_match0_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_enum_with_false_does_not_match0_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**EnumWithFalseDoesNotMatch0**](../../models/EnumWithFalseDoesNotMatch0.md) | | @@ -548,8 +528,6 @@ No authorization required # **post_enum_with_true_does_not_match1_request_body** -> post_enum_with_true_does_not_match1_request_body(body) - ### Example @@ -583,15 +561,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_enum_with_true_does_not_match1_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_enum_with_true_does_not_match1_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**EnumWithTrueDoesNotMatch1**](../../models/EnumWithTrueDoesNotMatch1.md) | | @@ -602,9 +580,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_enum_with_true_does_not_match1_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_enum_with_true_does_not_match1_request_body.response_for_200.ApiResponse) | success -#### post_enum_with_true_does_not_match1_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -619,8 +597,6 @@ No authorization required # **post_enum_with_true_does_not_match1_response_body_for_content_types** -> EnumWithTrueDoesNotMatch1 post_enum_with_true_does_not_match1_response_body_for_content_types() - ### Example @@ -628,7 +604,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import enum_api -from unit_test_api.model.enum_with_true_does_not_match1 import EnumWithTrueDoesNotMatch1 from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -656,16 +631,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_enum_with_true_does_not_match1_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_enum_with_true_does_not_match1_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_enum_with_true_does_not_match1_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_enum_with_true_does_not_match1_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**EnumWithTrueDoesNotMatch1**](../../models/EnumWithTrueDoesNotMatch1.md) | | @@ -679,8 +654,6 @@ No authorization required # **post_enums_in_properties_request_body** -> post_enums_in_properties_request_body(enums_in_properties) - ### Example @@ -717,15 +690,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_enums_in_properties_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_enums_in_properties_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**EnumsInProperties**](../../models/EnumsInProperties.md) | | @@ -736,9 +709,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_enums_in_properties_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_enums_in_properties_request_body.response_for_200.ApiResponse) | success -#### post_enums_in_properties_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -753,8 +726,6 @@ No authorization required # **post_enums_in_properties_response_body_for_content_types** -> EnumsInProperties post_enums_in_properties_response_body_for_content_types() - ### Example @@ -762,7 +733,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import enum_api -from unit_test_api.model.enums_in_properties import EnumsInProperties from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -790,16 +760,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_enums_in_properties_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_enums_in_properties_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_enums_in_properties_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_enums_in_properties_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**EnumsInProperties**](../../models/EnumsInProperties.md) | | @@ -813,8 +783,6 @@ No authorization required # **post_nul_characters_in_strings_request_body** -> post_nul_characters_in_strings_request_body(body) - ### Example @@ -848,15 +816,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_nul_characters_in_strings_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_nul_characters_in_strings_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**NulCharactersInStrings**](../../models/NulCharactersInStrings.md) | | @@ -867,9 +835,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_nul_characters_in_strings_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_nul_characters_in_strings_request_body.response_for_200.ApiResponse) | success -#### post_nul_characters_in_strings_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -884,8 +852,6 @@ No authorization required # **post_nul_characters_in_strings_response_body_for_content_types** -> NulCharactersInStrings post_nul_characters_in_strings_response_body_for_content_types() - ### Example @@ -893,7 +859,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import enum_api -from unit_test_api.model.nul_characters_in_strings import NulCharactersInStrings from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -921,16 +886,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_nul_characters_in_strings_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_nul_characters_in_strings_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_nul_characters_in_strings_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_nul_characters_in_strings_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**NulCharactersInStrings**](../../models/NulCharactersInStrings.md) | | @@ -944,8 +909,6 @@ No authorization required # **post_simple_enum_validation_request_body** -> post_simple_enum_validation_request_body(body) - ### Example @@ -979,15 +942,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_simple_enum_validation_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_simple_enum_validation_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**SimpleEnumValidation**](../../models/SimpleEnumValidation.md) | | @@ -998,9 +961,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_simple_enum_validation_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_simple_enum_validation_request_body.response_for_200.ApiResponse) | success -#### post_simple_enum_validation_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -1015,8 +978,6 @@ No authorization required # **post_simple_enum_validation_response_body_for_content_types** -> SimpleEnumValidation post_simple_enum_validation_response_body_for_content_types() - ### Example @@ -1024,7 +985,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import enum_api -from unit_test_api.model.simple_enum_validation import SimpleEnumValidation from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -1052,16 +1012,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_simple_enum_validation_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_simple_enum_validation_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_simple_enum_validation_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_simple_enum_validation_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**SimpleEnumValidation**](../../models/SimpleEnumValidation.md) | | diff --git a/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/FormatApi.md b/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/FormatApi.md index 08431f22e69..1eb9c5d3d0b 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/FormatApi.md +++ b/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/FormatApi.md @@ -26,8 +26,6 @@ Method | HTTP request | Description # **post_date_time_format_request_body** -> post_date_time_format_request_body(body) - ### Example @@ -35,6 +33,7 @@ Method | HTTP request | Description ```python import unit_test_api from unit_test_api.apis.tags import format_api +from unit_test_api.model.date_time_format import DateTimeFormat from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -48,7 +47,7 @@ with unit_test_api.ApiClient(configuration) as api_client: api_instance = format_api.FormatApi(api_client) # example passing only required values which don't have defaults set - body = None + body = DateTimeFormat(None) try: api_response = api_instance.post_date_time_format_request_body( body=body, @@ -60,29 +59,28 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_date_time_format_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_date_time_format_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**DateTimeFormat**](../../models/DateTimeFormat.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, | frozendict.frozendict, str, decimal.Decimal, BoolClass, NoneClass, tuple, bytes, FileIO | | value must conform to RFC-3339 date-time ### Return Types, Responses Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_date_time_format_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_date_time_format_request_body.response_for_200.ApiResponse) | success -#### post_date_time_format_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -97,8 +95,6 @@ No authorization required # **post_date_time_format_response_body_for_content_types** -> bool, date, datetime, dict, float, int, list, str, none_type post_date_time_format_response_body_for_content_types() - ### Example @@ -133,21 +129,20 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_date_time_format_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_date_time_format_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_date_time_format_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_date_time_format_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**DateTimeFormat**](../../models/DateTimeFormat.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, | frozendict.frozendict, str, decimal.Decimal, BoolClass, NoneClass, tuple, bytes, FileIO | | value must conform to RFC-3339 date-time ### Authorization @@ -157,8 +152,6 @@ No authorization required # **post_email_format_request_body** -> post_email_format_request_body(body) - ### Example @@ -166,6 +159,7 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import format_api +from unit_test_api.model.email_format import EmailFormat from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -179,7 +173,7 @@ with unit_test_api.ApiClient(configuration) as api_client: api_instance = format_api.FormatApi(api_client) # example passing only required values which don't have defaults set - body = None + body = EmailFormat(None) try: api_response = api_instance.post_email_format_request_body( body=body, @@ -191,29 +185,28 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_email_format_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_email_format_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**EmailFormat**](../../models/EmailFormat.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, | frozendict.frozendict, str, decimal.Decimal, BoolClass, NoneClass, tuple, bytes, FileIO | | ### Return Types, Responses Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_email_format_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_email_format_request_body.response_for_200.ApiResponse) | success -#### post_email_format_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -228,8 +221,6 @@ No authorization required # **post_email_format_response_body_for_content_types** -> bool, date, datetime, dict, float, int, list, str, none_type post_email_format_response_body_for_content_types() - ### Example @@ -264,21 +255,20 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_email_format_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_email_format_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_email_format_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_email_format_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**EmailFormat**](../../models/EmailFormat.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, | frozendict.frozendict, str, decimal.Decimal, BoolClass, NoneClass, tuple, bytes, FileIO | | ### Authorization @@ -288,8 +278,6 @@ No authorization required # **post_hostname_format_request_body** -> post_hostname_format_request_body(body) - ### Example @@ -297,6 +285,7 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import format_api +from unit_test_api.model.hostname_format import HostnameFormat from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -310,7 +299,7 @@ with unit_test_api.ApiClient(configuration) as api_client: api_instance = format_api.FormatApi(api_client) # example passing only required values which don't have defaults set - body = None + body = HostnameFormat(None) try: api_response = api_instance.post_hostname_format_request_body( body=body, @@ -322,29 +311,28 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_hostname_format_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_hostname_format_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**HostnameFormat**](../../models/HostnameFormat.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, | frozendict.frozendict, str, decimal.Decimal, BoolClass, NoneClass, tuple, bytes, FileIO | | ### Return Types, Responses Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_hostname_format_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_hostname_format_request_body.response_for_200.ApiResponse) | success -#### post_hostname_format_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -359,8 +347,6 @@ No authorization required # **post_hostname_format_response_body_for_content_types** -> bool, date, datetime, dict, float, int, list, str, none_type post_hostname_format_response_body_for_content_types() - ### Example @@ -395,21 +381,20 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_hostname_format_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_hostname_format_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_hostname_format_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_hostname_format_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**HostnameFormat**](../../models/HostnameFormat.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, | frozendict.frozendict, str, decimal.Decimal, BoolClass, NoneClass, tuple, bytes, FileIO | | ### Authorization @@ -419,8 +404,6 @@ No authorization required # **post_ipv4_format_request_body** -> post_ipv4_format_request_body(body) - ### Example @@ -428,6 +411,7 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import format_api +from unit_test_api.model.ipv4_format import Ipv4Format from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -441,7 +425,7 @@ with unit_test_api.ApiClient(configuration) as api_client: api_instance = format_api.FormatApi(api_client) # example passing only required values which don't have defaults set - body = None + body = Ipv4Format(None) try: api_response = api_instance.post_ipv4_format_request_body( body=body, @@ -453,29 +437,28 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_ipv4_format_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_ipv4_format_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**Ipv4Format**](../../models/Ipv4Format.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, | frozendict.frozendict, str, decimal.Decimal, BoolClass, NoneClass, tuple, bytes, FileIO | | ### Return Types, Responses Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_ipv4_format_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_ipv4_format_request_body.response_for_200.ApiResponse) | success -#### post_ipv4_format_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -490,8 +473,6 @@ No authorization required # **post_ipv4_format_response_body_for_content_types** -> bool, date, datetime, dict, float, int, list, str, none_type post_ipv4_format_response_body_for_content_types() - ### Example @@ -526,21 +507,20 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_ipv4_format_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_ipv4_format_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_ipv4_format_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_ipv4_format_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**Ipv4Format**](../../models/Ipv4Format.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, | frozendict.frozendict, str, decimal.Decimal, BoolClass, NoneClass, tuple, bytes, FileIO | | ### Authorization @@ -550,8 +530,6 @@ No authorization required # **post_ipv6_format_request_body** -> post_ipv6_format_request_body(body) - ### Example @@ -559,6 +537,7 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import format_api +from unit_test_api.model.ipv6_format import Ipv6Format from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -572,7 +551,7 @@ with unit_test_api.ApiClient(configuration) as api_client: api_instance = format_api.FormatApi(api_client) # example passing only required values which don't have defaults set - body = None + body = Ipv6Format(None) try: api_response = api_instance.post_ipv6_format_request_body( body=body, @@ -584,29 +563,28 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_ipv6_format_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_ipv6_format_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**Ipv6Format**](../../models/Ipv6Format.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, | frozendict.frozendict, str, decimal.Decimal, BoolClass, NoneClass, tuple, bytes, FileIO | | ### Return Types, Responses Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_ipv6_format_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_ipv6_format_request_body.response_for_200.ApiResponse) | success -#### post_ipv6_format_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -621,8 +599,6 @@ No authorization required # **post_ipv6_format_response_body_for_content_types** -> bool, date, datetime, dict, float, int, list, str, none_type post_ipv6_format_response_body_for_content_types() - ### Example @@ -657,21 +633,20 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_ipv6_format_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_ipv6_format_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_ipv6_format_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_ipv6_format_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**Ipv6Format**](../../models/Ipv6Format.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, | frozendict.frozendict, str, decimal.Decimal, BoolClass, NoneClass, tuple, bytes, FileIO | | ### Authorization @@ -681,8 +656,6 @@ No authorization required # **post_json_pointer_format_request_body** -> post_json_pointer_format_request_body(body) - ### Example @@ -690,6 +663,7 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import format_api +from unit_test_api.model.json_pointer_format import JsonPointerFormat from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -703,7 +677,7 @@ with unit_test_api.ApiClient(configuration) as api_client: api_instance = format_api.FormatApi(api_client) # example passing only required values which don't have defaults set - body = None + body = JsonPointerFormat(None) try: api_response = api_instance.post_json_pointer_format_request_body( body=body, @@ -715,29 +689,28 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_json_pointer_format_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_json_pointer_format_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**JsonPointerFormat**](../../models/JsonPointerFormat.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, | frozendict.frozendict, str, decimal.Decimal, BoolClass, NoneClass, tuple, bytes, FileIO | | ### Return Types, Responses Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_json_pointer_format_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_json_pointer_format_request_body.response_for_200.ApiResponse) | success -#### post_json_pointer_format_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -752,8 +725,6 @@ No authorization required # **post_json_pointer_format_response_body_for_content_types** -> bool, date, datetime, dict, float, int, list, str, none_type post_json_pointer_format_response_body_for_content_types() - ### Example @@ -788,21 +759,20 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_json_pointer_format_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_json_pointer_format_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_json_pointer_format_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_json_pointer_format_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**JsonPointerFormat**](../../models/JsonPointerFormat.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, | frozendict.frozendict, str, decimal.Decimal, BoolClass, NoneClass, tuple, bytes, FileIO | | ### Authorization @@ -812,8 +782,6 @@ No authorization required # **post_uri_format_request_body** -> post_uri_format_request_body(body) - ### Example @@ -821,6 +789,7 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import format_api +from unit_test_api.model.uri_format import UriFormat from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -834,7 +803,7 @@ with unit_test_api.ApiClient(configuration) as api_client: api_instance = format_api.FormatApi(api_client) # example passing only required values which don't have defaults set - body = None + body = UriFormat(None) try: api_response = api_instance.post_uri_format_request_body( body=body, @@ -846,29 +815,28 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_uri_format_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_uri_format_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**UriFormat**](../../models/UriFormat.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, | frozendict.frozendict, str, decimal.Decimal, BoolClass, NoneClass, tuple, bytes, FileIO | | ### Return Types, Responses Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_uri_format_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_uri_format_request_body.response_for_200.ApiResponse) | success -#### post_uri_format_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -883,8 +851,6 @@ No authorization required # **post_uri_format_response_body_for_content_types** -> bool, date, datetime, dict, float, int, list, str, none_type post_uri_format_response_body_for_content_types() - ### Example @@ -919,21 +885,20 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_uri_format_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_uri_format_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_uri_format_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_uri_format_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**UriFormat**](../../models/UriFormat.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, | frozendict.frozendict, str, decimal.Decimal, BoolClass, NoneClass, tuple, bytes, FileIO | | ### Authorization @@ -943,8 +908,6 @@ No authorization required # **post_uri_reference_format_request_body** -> post_uri_reference_format_request_body(body) - ### Example @@ -952,6 +915,7 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import format_api +from unit_test_api.model.uri_reference_format import UriReferenceFormat from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -965,7 +929,7 @@ with unit_test_api.ApiClient(configuration) as api_client: api_instance = format_api.FormatApi(api_client) # example passing only required values which don't have defaults set - body = None + body = UriReferenceFormat(None) try: api_response = api_instance.post_uri_reference_format_request_body( body=body, @@ -977,29 +941,28 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_uri_reference_format_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_uri_reference_format_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**UriReferenceFormat**](../../models/UriReferenceFormat.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, | frozendict.frozendict, str, decimal.Decimal, BoolClass, NoneClass, tuple, bytes, FileIO | | ### Return Types, Responses Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_uri_reference_format_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_uri_reference_format_request_body.response_for_200.ApiResponse) | success -#### post_uri_reference_format_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -1014,8 +977,6 @@ No authorization required # **post_uri_reference_format_response_body_for_content_types** -> bool, date, datetime, dict, float, int, list, str, none_type post_uri_reference_format_response_body_for_content_types() - ### Example @@ -1050,21 +1011,20 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_uri_reference_format_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_uri_reference_format_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_uri_reference_format_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_uri_reference_format_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**UriReferenceFormat**](../../models/UriReferenceFormat.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, | frozendict.frozendict, str, decimal.Decimal, BoolClass, NoneClass, tuple, bytes, FileIO | | ### Authorization @@ -1074,8 +1034,6 @@ No authorization required # **post_uri_template_format_request_body** -> post_uri_template_format_request_body(body) - ### Example @@ -1083,6 +1041,7 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import format_api +from unit_test_api.model.uri_template_format import UriTemplateFormat from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -1096,7 +1055,7 @@ with unit_test_api.ApiClient(configuration) as api_client: api_instance = format_api.FormatApi(api_client) # example passing only required values which don't have defaults set - body = None + body = UriTemplateFormat(None) try: api_response = api_instance.post_uri_template_format_request_body( body=body, @@ -1108,29 +1067,28 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_uri_template_format_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_uri_template_format_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**UriTemplateFormat**](../../models/UriTemplateFormat.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, | frozendict.frozendict, str, decimal.Decimal, BoolClass, NoneClass, tuple, bytes, FileIO | | ### Return Types, Responses Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_uri_template_format_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_uri_template_format_request_body.response_for_200.ApiResponse) | success -#### post_uri_template_format_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -1145,8 +1103,6 @@ No authorization required # **post_uri_template_format_response_body_for_content_types** -> bool, date, datetime, dict, float, int, list, str, none_type post_uri_template_format_response_body_for_content_types() - ### Example @@ -1181,21 +1137,20 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_uri_template_format_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_uri_template_format_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_uri_template_format_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_uri_template_format_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**UriTemplateFormat**](../../models/UriTemplateFormat.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, | frozendict.frozendict, str, decimal.Decimal, BoolClass, NoneClass, tuple, bytes, FileIO | | ### Authorization diff --git a/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/ItemsApi.md b/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/ItemsApi.md index a3892956f16..e1af6fb8716 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/ItemsApi.md +++ b/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/ItemsApi.md @@ -10,8 +10,6 @@ Method | HTTP request | Description # **post_nested_items_request_body** -> post_nested_items_request_body(nested_items) - ### Example @@ -53,15 +51,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_nested_items_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_nested_items_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**NestedItems**](../../models/NestedItems.md) | | @@ -72,9 +70,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_nested_items_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_nested_items_request_body.response_for_200.ApiResponse) | success -#### post_nested_items_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -89,8 +87,6 @@ No authorization required # **post_nested_items_response_body_for_content_types** -> NestedItems post_nested_items_response_body_for_content_types() - ### Example @@ -98,7 +94,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import items_api -from unit_test_api.model.nested_items import NestedItems from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -126,16 +121,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_nested_items_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_nested_items_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_nested_items_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_nested_items_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**NestedItems**](../../models/NestedItems.md) | | diff --git a/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/MaxItemsApi.md b/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/MaxItemsApi.md index 481d933e61f..835ff85e7f5 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/MaxItemsApi.md +++ b/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/MaxItemsApi.md @@ -10,8 +10,6 @@ Method | HTTP request | Description # **post_maxitems_validation_request_body** -> post_maxitems_validation_request_body(body) - ### Example @@ -45,15 +43,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_maxitems_validation_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_maxitems_validation_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**MaxitemsValidation**](../../models/MaxitemsValidation.md) | | @@ -64,9 +62,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_maxitems_validation_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_maxitems_validation_request_body.response_for_200.ApiResponse) | success -#### post_maxitems_validation_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -81,8 +79,6 @@ No authorization required # **post_maxitems_validation_response_body_for_content_types** -> MaxitemsValidation post_maxitems_validation_response_body_for_content_types() - ### Example @@ -90,7 +86,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import max_items_api -from unit_test_api.model.maxitems_validation import MaxitemsValidation from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -118,16 +113,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_maxitems_validation_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_maxitems_validation_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_maxitems_validation_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_maxitems_validation_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**MaxitemsValidation**](../../models/MaxitemsValidation.md) | | diff --git a/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/MaxLengthApi.md b/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/MaxLengthApi.md index 98d63d49245..e6c9f74f254 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/MaxLengthApi.md +++ b/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/MaxLengthApi.md @@ -10,8 +10,6 @@ Method | HTTP request | Description # **post_maxlength_validation_request_body** -> post_maxlength_validation_request_body(body) - ### Example @@ -45,15 +43,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_maxlength_validation_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_maxlength_validation_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**MaxlengthValidation**](../../models/MaxlengthValidation.md) | | @@ -64,9 +62,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_maxlength_validation_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_maxlength_validation_request_body.response_for_200.ApiResponse) | success -#### post_maxlength_validation_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -81,8 +79,6 @@ No authorization required # **post_maxlength_validation_response_body_for_content_types** -> MaxlengthValidation post_maxlength_validation_response_body_for_content_types() - ### Example @@ -90,7 +86,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import max_length_api -from unit_test_api.model.maxlength_validation import MaxlengthValidation from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -118,16 +113,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_maxlength_validation_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_maxlength_validation_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_maxlength_validation_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_maxlength_validation_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**MaxlengthValidation**](../../models/MaxlengthValidation.md) | | diff --git a/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/MaxPropertiesApi.md b/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/MaxPropertiesApi.md index 30bb70e217f..46fb9b9bf41 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/MaxPropertiesApi.md +++ b/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/MaxPropertiesApi.md @@ -12,8 +12,6 @@ Method | HTTP request | Description # **post_maxproperties0_means_the_object_is_empty_request_body** -> post_maxproperties0_means_the_object_is_empty_request_body(body) - ### Example @@ -47,15 +45,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_maxproperties0_means_the_object_is_empty_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_maxproperties0_means_the_object_is_empty_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**Maxproperties0MeansTheObjectIsEmpty**](../../models/Maxproperties0MeansTheObjectIsEmpty.md) | | @@ -66,9 +64,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_maxproperties0_means_the_object_is_empty_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_maxproperties0_means_the_object_is_empty_request_body.response_for_200.ApiResponse) | success -#### post_maxproperties0_means_the_object_is_empty_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -83,8 +81,6 @@ No authorization required # **post_maxproperties0_means_the_object_is_empty_response_body_for_content_types** -> Maxproperties0MeansTheObjectIsEmpty post_maxproperties0_means_the_object_is_empty_response_body_for_content_types() - ### Example @@ -92,7 +88,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import max_properties_api -from unit_test_api.model.maxproperties0_means_the_object_is_empty import Maxproperties0MeansTheObjectIsEmpty from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -120,16 +115,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_maxproperties0_means_the_object_is_empty_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_maxproperties0_means_the_object_is_empty_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_maxproperties0_means_the_object_is_empty_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_maxproperties0_means_the_object_is_empty_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**Maxproperties0MeansTheObjectIsEmpty**](../../models/Maxproperties0MeansTheObjectIsEmpty.md) | | @@ -143,8 +138,6 @@ No authorization required # **post_maxproperties_validation_request_body** -> post_maxproperties_validation_request_body(body) - ### Example @@ -178,15 +171,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_maxproperties_validation_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_maxproperties_validation_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**MaxpropertiesValidation**](../../models/MaxpropertiesValidation.md) | | @@ -197,9 +190,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_maxproperties_validation_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_maxproperties_validation_request_body.response_for_200.ApiResponse) | success -#### post_maxproperties_validation_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -214,8 +207,6 @@ No authorization required # **post_maxproperties_validation_response_body_for_content_types** -> MaxpropertiesValidation post_maxproperties_validation_response_body_for_content_types() - ### Example @@ -223,7 +214,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import max_properties_api -from unit_test_api.model.maxproperties_validation import MaxpropertiesValidation from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -251,16 +241,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_maxproperties_validation_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_maxproperties_validation_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_maxproperties_validation_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_maxproperties_validation_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**MaxpropertiesValidation**](../../models/MaxpropertiesValidation.md) | | diff --git a/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/MaximumApi.md b/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/MaximumApi.md index 388aa8b796a..d5e7884efe3 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/MaximumApi.md +++ b/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/MaximumApi.md @@ -12,8 +12,6 @@ Method | HTTP request | Description # **post_maximum_validation_request_body** -> post_maximum_validation_request_body(body) - ### Example @@ -47,15 +45,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_maximum_validation_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_maximum_validation_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**MaximumValidation**](../../models/MaximumValidation.md) | | @@ -66,9 +64,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_maximum_validation_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_maximum_validation_request_body.response_for_200.ApiResponse) | success -#### post_maximum_validation_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -83,8 +81,6 @@ No authorization required # **post_maximum_validation_response_body_for_content_types** -> MaximumValidation post_maximum_validation_response_body_for_content_types() - ### Example @@ -92,7 +88,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import maximum_api -from unit_test_api.model.maximum_validation import MaximumValidation from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -120,16 +115,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_maximum_validation_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_maximum_validation_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_maximum_validation_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_maximum_validation_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**MaximumValidation**](../../models/MaximumValidation.md) | | @@ -143,8 +138,6 @@ No authorization required # **post_maximum_validation_with_unsigned_integer_request_body** -> post_maximum_validation_with_unsigned_integer_request_body(body) - ### Example @@ -178,15 +171,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_maximum_validation_with_unsigned_integer_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_maximum_validation_with_unsigned_integer_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**MaximumValidationWithUnsignedInteger**](../../models/MaximumValidationWithUnsignedInteger.md) | | @@ -197,9 +190,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_maximum_validation_with_unsigned_integer_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_maximum_validation_with_unsigned_integer_request_body.response_for_200.ApiResponse) | success -#### post_maximum_validation_with_unsigned_integer_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -214,8 +207,6 @@ No authorization required # **post_maximum_validation_with_unsigned_integer_response_body_for_content_types** -> MaximumValidationWithUnsignedInteger post_maximum_validation_with_unsigned_integer_response_body_for_content_types() - ### Example @@ -223,7 +214,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import maximum_api -from unit_test_api.model.maximum_validation_with_unsigned_integer import MaximumValidationWithUnsignedInteger from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -251,16 +241,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_maximum_validation_with_unsigned_integer_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_maximum_validation_with_unsigned_integer_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_maximum_validation_with_unsigned_integer_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_maximum_validation_with_unsigned_integer_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**MaximumValidationWithUnsignedInteger**](../../models/MaximumValidationWithUnsignedInteger.md) | | diff --git a/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/MinItemsApi.md b/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/MinItemsApi.md index 47fece84820..6058a8c5e42 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/MinItemsApi.md +++ b/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/MinItemsApi.md @@ -10,8 +10,6 @@ Method | HTTP request | Description # **post_minitems_validation_request_body** -> post_minitems_validation_request_body(body) - ### Example @@ -45,15 +43,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_minitems_validation_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_minitems_validation_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**MinitemsValidation**](../../models/MinitemsValidation.md) | | @@ -64,9 +62,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_minitems_validation_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_minitems_validation_request_body.response_for_200.ApiResponse) | success -#### post_minitems_validation_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -81,8 +79,6 @@ No authorization required # **post_minitems_validation_response_body_for_content_types** -> MinitemsValidation post_minitems_validation_response_body_for_content_types() - ### Example @@ -90,7 +86,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import min_items_api -from unit_test_api.model.minitems_validation import MinitemsValidation from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -118,16 +113,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_minitems_validation_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_minitems_validation_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_minitems_validation_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_minitems_validation_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**MinitemsValidation**](../../models/MinitemsValidation.md) | | diff --git a/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/MinLengthApi.md b/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/MinLengthApi.md index 918d02f43ef..8a9e64df109 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/MinLengthApi.md +++ b/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/MinLengthApi.md @@ -10,8 +10,6 @@ Method | HTTP request | Description # **post_minlength_validation_request_body** -> post_minlength_validation_request_body(body) - ### Example @@ -45,15 +43,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_minlength_validation_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_minlength_validation_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**MinlengthValidation**](../../models/MinlengthValidation.md) | | @@ -64,9 +62,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_minlength_validation_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_minlength_validation_request_body.response_for_200.ApiResponse) | success -#### post_minlength_validation_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -81,8 +79,6 @@ No authorization required # **post_minlength_validation_response_body_for_content_types** -> MinlengthValidation post_minlength_validation_response_body_for_content_types() - ### Example @@ -90,7 +86,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import min_length_api -from unit_test_api.model.minlength_validation import MinlengthValidation from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -118,16 +113,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_minlength_validation_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_minlength_validation_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_minlength_validation_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_minlength_validation_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**MinlengthValidation**](../../models/MinlengthValidation.md) | | diff --git a/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/MinPropertiesApi.md b/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/MinPropertiesApi.md index 7d44da6f0b4..e67e4dfe632 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/MinPropertiesApi.md +++ b/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/MinPropertiesApi.md @@ -10,8 +10,6 @@ Method | HTTP request | Description # **post_minproperties_validation_request_body** -> post_minproperties_validation_request_body(body) - ### Example @@ -45,15 +43,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_minproperties_validation_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_minproperties_validation_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**MinpropertiesValidation**](../../models/MinpropertiesValidation.md) | | @@ -64,9 +62,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_minproperties_validation_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_minproperties_validation_request_body.response_for_200.ApiResponse) | success -#### post_minproperties_validation_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -81,8 +79,6 @@ No authorization required # **post_minproperties_validation_response_body_for_content_types** -> MinpropertiesValidation post_minproperties_validation_response_body_for_content_types() - ### Example @@ -90,7 +86,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import min_properties_api -from unit_test_api.model.minproperties_validation import MinpropertiesValidation from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -118,16 +113,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_minproperties_validation_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_minproperties_validation_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_minproperties_validation_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_minproperties_validation_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**MinpropertiesValidation**](../../models/MinpropertiesValidation.md) | | diff --git a/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/MinimumApi.md b/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/MinimumApi.md index b176533c963..8d498544493 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/MinimumApi.md +++ b/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/MinimumApi.md @@ -12,8 +12,6 @@ Method | HTTP request | Description # **post_minimum_validation_request_body** -> post_minimum_validation_request_body(body) - ### Example @@ -47,15 +45,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_minimum_validation_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_minimum_validation_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**MinimumValidation**](../../models/MinimumValidation.md) | | @@ -66,9 +64,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_minimum_validation_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_minimum_validation_request_body.response_for_200.ApiResponse) | success -#### post_minimum_validation_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -83,8 +81,6 @@ No authorization required # **post_minimum_validation_response_body_for_content_types** -> MinimumValidation post_minimum_validation_response_body_for_content_types() - ### Example @@ -92,7 +88,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import minimum_api -from unit_test_api.model.minimum_validation import MinimumValidation from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -120,16 +115,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_minimum_validation_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_minimum_validation_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_minimum_validation_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_minimum_validation_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**MinimumValidation**](../../models/MinimumValidation.md) | | @@ -143,8 +138,6 @@ No authorization required # **post_minimum_validation_with_signed_integer_request_body** -> post_minimum_validation_with_signed_integer_request_body(body) - ### Example @@ -178,15 +171,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_minimum_validation_with_signed_integer_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_minimum_validation_with_signed_integer_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**MinimumValidationWithSignedInteger**](../../models/MinimumValidationWithSignedInteger.md) | | @@ -197,9 +190,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_minimum_validation_with_signed_integer_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_minimum_validation_with_signed_integer_request_body.response_for_200.ApiResponse) | success -#### post_minimum_validation_with_signed_integer_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -214,8 +207,6 @@ No authorization required # **post_minimum_validation_with_signed_integer_response_body_for_content_types** -> MinimumValidationWithSignedInteger post_minimum_validation_with_signed_integer_response_body_for_content_types() - ### Example @@ -223,7 +214,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import minimum_api -from unit_test_api.model.minimum_validation_with_signed_integer import MinimumValidationWithSignedInteger from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -251,16 +241,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_minimum_validation_with_signed_integer_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_minimum_validation_with_signed_integer_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_minimum_validation_with_signed_integer_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_minimum_validation_with_signed_integer_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**MinimumValidationWithSignedInteger**](../../models/MinimumValidationWithSignedInteger.md) | | diff --git a/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/ModelNotApi.md b/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/ModelNotApi.md index 0c1ab7ec02d..c5e1f4af462 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/ModelNotApi.md +++ b/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/ModelNotApi.md @@ -14,8 +14,6 @@ Method | HTTP request | Description # **post_forbidden_property_request_body** -> post_forbidden_property_request_body(forbidden_property) - ### Example @@ -49,15 +47,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_forbidden_property_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_forbidden_property_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**ForbiddenProperty**](../../models/ForbiddenProperty.md) | | @@ -68,9 +66,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_forbidden_property_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_forbidden_property_request_body.response_for_200.ApiResponse) | success -#### post_forbidden_property_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -85,8 +83,6 @@ No authorization required # **post_forbidden_property_response_body_for_content_types** -> ForbiddenProperty post_forbidden_property_response_body_for_content_types() - ### Example @@ -94,7 +90,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import model_not_api -from unit_test_api.model.forbidden_property import ForbiddenProperty from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -122,16 +117,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_forbidden_property_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_forbidden_property_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_forbidden_property_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_forbidden_property_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**ForbiddenProperty**](../../models/ForbiddenProperty.md) | | @@ -145,8 +140,6 @@ No authorization required # **post_not_more_complex_schema_request_body** -> post_not_more_complex_schema_request_body(body) - ### Example @@ -154,6 +147,7 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import model_not_api +from unit_test_api.model.not_more_complex_schema import NotMoreComplexSchema from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -167,7 +161,7 @@ with unit_test_api.ApiClient(configuration) as api_client: api_instance = model_not_api.ModelNotApi(api_client) # example passing only required values which don't have defaults set - body = None + body = NotMoreComplexSchema(None) try: api_response = api_instance.post_not_more_complex_schema_request_body( body=body, @@ -179,48 +173,28 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_not_more_complex_schema_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_not_more_complex_schema_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body - -# SchemaForRequestBodyApplicationJson - -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, | frozendict.frozendict, str, decimal.Decimal, BoolClass, NoneClass, tuple, bytes, FileIO | | - -### Composed Schemas (allOf/anyOf/oneOf/not) -#### not -Class Name | Input Type | Accessed Type | Description | Notes -------------- | ------------- | ------------- | ------------- | ------------- -[not_schema](#not_schema) | dict, frozendict.frozendict, | frozendict.frozendict, | | - -# not_schema +### body -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, | frozendict.frozendict, | | +# RequestBody.Schemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**NotMoreComplexSchema**](../../models/NotMoreComplexSchema.md) | | -### Dictionary Keys -Key | Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- | ------------- -**foo** | str, | str, | | [optional] -**any_string_name** | dict, frozendict.frozendict, str, date, datetime, int, float, bool, decimal.Decimal, None, list, tuple, bytes, io.FileIO, io.BufferedReader | frozendict.frozendict, str, BoolClass, decimal.Decimal, NoneClass, tuple, bytes, FileIO | any string name can be used but the value must be the correct type | [optional] ### Return Types, Responses Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_not_more_complex_schema_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_not_more_complex_schema_request_body.response_for_200.ApiResponse) | success -#### post_not_more_complex_schema_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -235,8 +209,6 @@ No authorization required # **post_not_more_complex_schema_response_body_for_content_types** -> bool, date, datetime, dict, float, int, list, str, none_type post_not_more_complex_schema_response_body_for_content_types() - ### Example @@ -271,40 +243,20 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_not_more_complex_schema_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_not_more_complex_schema_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_not_more_complex_schema_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_not_more_complex_schema_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson - -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, | frozendict.frozendict, str, decimal.Decimal, BoolClass, NoneClass, tuple, bytes, FileIO | | - -### Composed Schemas (allOf/anyOf/oneOf/not) -#### not -Class Name | Input Type | Accessed Type | Description | Notes -------------- | ------------- | ------------- | ------------- | ------------- -[not_schema](#not_schema) | dict, frozendict.frozendict, | frozendict.frozendict, | | - -# not_schema - -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, | frozendict.frozendict, | | +# response_for_200.BodySchemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**NotMoreComplexSchema**](../../models/NotMoreComplexSchema.md) | | -### Dictionary Keys -Key | Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- | ------------- -**foo** | str, | str, | | [optional] -**any_string_name** | dict, frozendict.frozendict, str, date, datetime, int, float, bool, decimal.Decimal, None, list, tuple, bytes, io.FileIO, io.BufferedReader | frozendict.frozendict, str, BoolClass, decimal.Decimal, NoneClass, tuple, bytes, FileIO | any string name can be used but the value must be the correct type | [optional] ### Authorization @@ -314,8 +266,6 @@ No authorization required # **post_not_request_body** -> post_not_request_body(body) - ### Example @@ -323,6 +273,7 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import model_not_api +from unit_test_api.model.model_not import ModelNot from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -336,7 +287,7 @@ with unit_test_api.ApiClient(configuration) as api_client: api_instance = model_not_api.ModelNotApi(api_client) # example passing only required values which don't have defaults set - body = None + body = ModelNot(None) try: api_response = api_instance.post_not_request_body( body=body, @@ -348,42 +299,28 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_not_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_not_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body - -# SchemaForRequestBodyApplicationJson +### body -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, | frozendict.frozendict, str, decimal.Decimal, BoolClass, NoneClass, tuple, bytes, FileIO | | - -### Composed Schemas (allOf/anyOf/oneOf/not) -#### not -Class Name | Input Type | Accessed Type | Description | Notes -------------- | ------------- | ------------- | ------------- | ------------- -[not_schema](#not_schema) | decimal.Decimal, int, | decimal.Decimal, | | - -# not_schema +# RequestBody.Schemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**ModelNot**](../../models/ModelNot.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -decimal.Decimal, int, | decimal.Decimal, | | ### Return Types, Responses Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_not_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_not_request_body.response_for_200.ApiResponse) | success -#### post_not_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -398,8 +335,6 @@ No authorization required # **post_not_response_body_for_content_types** -> bool, date, datetime, dict, float, int, list, str, none_type post_not_response_body_for_content_types() - ### Example @@ -434,34 +369,20 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_not_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_not_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_not_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_not_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson - -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, | frozendict.frozendict, str, decimal.Decimal, BoolClass, NoneClass, tuple, bytes, FileIO | | - -### Composed Schemas (allOf/anyOf/oneOf/not) -#### not -Class Name | Input Type | Accessed Type | Description | Notes -------------- | ------------- | ------------- | ------------- | ------------- -[not_schema](#not_schema) | decimal.Decimal, int, | decimal.Decimal, | | - -# not_schema +# response_for_200.BodySchemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**ModelNot**](../../models/ModelNot.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -decimal.Decimal, int, | decimal.Decimal, | | ### Authorization diff --git a/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/MultipleOfApi.md b/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/MultipleOfApi.md index dae45d4773b..5bd7a567eb6 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/MultipleOfApi.md +++ b/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/MultipleOfApi.md @@ -16,8 +16,6 @@ Method | HTTP request | Description # **post_by_int_request_body** -> post_by_int_request_body(body) - ### Example @@ -51,15 +49,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_by_int_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_by_int_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**ByInt**](../../models/ByInt.md) | | @@ -70,9 +68,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_by_int_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_by_int_request_body.response_for_200.ApiResponse) | success -#### post_by_int_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -87,8 +85,6 @@ No authorization required # **post_by_int_response_body_for_content_types** -> ByInt post_by_int_response_body_for_content_types() - ### Example @@ -96,7 +92,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import multiple_of_api -from unit_test_api.model.by_int import ByInt from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -124,16 +119,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_by_int_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_by_int_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_by_int_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_by_int_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**ByInt**](../../models/ByInt.md) | | @@ -147,8 +142,6 @@ No authorization required # **post_by_number_request_body** -> post_by_number_request_body(body) - ### Example @@ -182,15 +175,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_by_number_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_by_number_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**ByNumber**](../../models/ByNumber.md) | | @@ -201,9 +194,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_by_number_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_by_number_request_body.response_for_200.ApiResponse) | success -#### post_by_number_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -218,8 +211,6 @@ No authorization required # **post_by_number_response_body_for_content_types** -> ByNumber post_by_number_response_body_for_content_types() - ### Example @@ -227,7 +218,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import multiple_of_api -from unit_test_api.model.by_number import ByNumber from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -255,16 +245,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_by_number_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_by_number_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_by_number_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_by_number_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**ByNumber**](../../models/ByNumber.md) | | @@ -278,8 +268,6 @@ No authorization required # **post_by_small_number_request_body** -> post_by_small_number_request_body(body) - ### Example @@ -313,15 +301,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_by_small_number_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_by_small_number_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**BySmallNumber**](../../models/BySmallNumber.md) | | @@ -332,9 +320,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_by_small_number_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_by_small_number_request_body.response_for_200.ApiResponse) | success -#### post_by_small_number_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -349,8 +337,6 @@ No authorization required # **post_by_small_number_response_body_for_content_types** -> BySmallNumber post_by_small_number_response_body_for_content_types() - ### Example @@ -358,7 +344,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import multiple_of_api -from unit_test_api.model.by_small_number import BySmallNumber from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -386,16 +371,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_by_small_number_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_by_small_number_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_by_small_number_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_by_small_number_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**BySmallNumber**](../../models/BySmallNumber.md) | | @@ -409,8 +394,6 @@ No authorization required # **post_invalid_instance_should_not_raise_error_when_float_division_inf_request_body** -> post_invalid_instance_should_not_raise_error_when_float_division_inf_request_body(body) - ### Example @@ -444,15 +427,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_invalid_instance_should_not_raise_error_when_float_division_inf_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_invalid_instance_should_not_raise_error_when_float_division_inf_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf**](../../models/InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf.md) | | @@ -463,9 +446,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_invalid_instance_should_not_raise_error_when_float_division_inf_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_invalid_instance_should_not_raise_error_when_float_division_inf_request_body.response_for_200.ApiResponse) | success -#### post_invalid_instance_should_not_raise_error_when_float_division_inf_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -480,8 +463,6 @@ No authorization required # **post_invalid_instance_should_not_raise_error_when_float_division_inf_response_body_for_content_types** -> InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf post_invalid_instance_should_not_raise_error_when_float_division_inf_response_body_for_content_types() - ### Example @@ -489,7 +470,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import multiple_of_api -from unit_test_api.model.invalid_instance_should_not_raise_error_when_float_division_inf import InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -517,16 +497,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_invalid_instance_should_not_raise_error_when_float_division_inf_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_invalid_instance_should_not_raise_error_when_float_division_inf_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_invalid_instance_should_not_raise_error_when_float_division_inf_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_invalid_instance_should_not_raise_error_when_float_division_inf_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf**](../../models/InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf.md) | | diff --git a/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/OneOfApi.md b/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/OneOfApi.md index 9f6c2b244d0..36d4871b16a 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/OneOfApi.md +++ b/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/OneOfApi.md @@ -20,8 +20,6 @@ Method | HTTP request | Description # **post_nested_oneof_to_check_validation_semantics_request_body** -> post_nested_oneof_to_check_validation_semantics_request_body(nested_oneof_to_check_validation_semantics) - ### Example @@ -55,15 +53,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_nested_oneof_to_check_validation_semantics_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_nested_oneof_to_check_validation_semantics_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**NestedOneofToCheckValidationSemantics**](../../models/NestedOneofToCheckValidationSemantics.md) | | @@ -74,9 +72,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_nested_oneof_to_check_validation_semantics_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_nested_oneof_to_check_validation_semantics_request_body.response_for_200.ApiResponse) | success -#### post_nested_oneof_to_check_validation_semantics_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -91,8 +89,6 @@ No authorization required # **post_nested_oneof_to_check_validation_semantics_response_body_for_content_types** -> NestedOneofToCheckValidationSemantics post_nested_oneof_to_check_validation_semantics_response_body_for_content_types() - ### Example @@ -100,7 +96,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import one_of_api -from unit_test_api.model.nested_oneof_to_check_validation_semantics import NestedOneofToCheckValidationSemantics from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -128,16 +123,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_nested_oneof_to_check_validation_semantics_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_nested_oneof_to_check_validation_semantics_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_nested_oneof_to_check_validation_semantics_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_nested_oneof_to_check_validation_semantics_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**NestedOneofToCheckValidationSemantics**](../../models/NestedOneofToCheckValidationSemantics.md) | | @@ -151,8 +146,6 @@ No authorization required # **post_oneof_complex_types_request_body** -> post_oneof_complex_types_request_body(oneof_complex_types) - ### Example @@ -186,15 +179,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_oneof_complex_types_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_oneof_complex_types_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**OneofComplexTypes**](../../models/OneofComplexTypes.md) | | @@ -205,9 +198,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_oneof_complex_types_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_oneof_complex_types_request_body.response_for_200.ApiResponse) | success -#### post_oneof_complex_types_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -222,8 +215,6 @@ No authorization required # **post_oneof_complex_types_response_body_for_content_types** -> OneofComplexTypes post_oneof_complex_types_response_body_for_content_types() - ### Example @@ -231,7 +222,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import one_of_api -from unit_test_api.model.oneof_complex_types import OneofComplexTypes from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -259,16 +249,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_oneof_complex_types_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_oneof_complex_types_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_oneof_complex_types_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_oneof_complex_types_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**OneofComplexTypes**](../../models/OneofComplexTypes.md) | | @@ -282,8 +272,6 @@ No authorization required # **post_oneof_request_body** -> post_oneof_request_body(oneof) - ### Example @@ -317,15 +305,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_oneof_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_oneof_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**Oneof**](../../models/Oneof.md) | | @@ -336,9 +324,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_oneof_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_oneof_request_body.response_for_200.ApiResponse) | success -#### post_oneof_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -353,8 +341,6 @@ No authorization required # **post_oneof_response_body_for_content_types** -> Oneof post_oneof_response_body_for_content_types() - ### Example @@ -362,7 +348,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import one_of_api -from unit_test_api.model.oneof import Oneof from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -390,16 +375,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_oneof_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_oneof_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_oneof_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_oneof_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**Oneof**](../../models/Oneof.md) | | @@ -413,8 +398,6 @@ No authorization required # **post_oneof_with_base_schema_request_body** -> post_oneof_with_base_schema_request_body(body) - ### Example @@ -448,15 +431,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_oneof_with_base_schema_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_oneof_with_base_schema_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**OneofWithBaseSchema**](../../models/OneofWithBaseSchema.md) | | @@ -467,9 +450,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_oneof_with_base_schema_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_oneof_with_base_schema_request_body.response_for_200.ApiResponse) | success -#### post_oneof_with_base_schema_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -484,8 +467,6 @@ No authorization required # **post_oneof_with_base_schema_response_body_for_content_types** -> OneofWithBaseSchema post_oneof_with_base_schema_response_body_for_content_types() - ### Example @@ -493,7 +474,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import one_of_api -from unit_test_api.model.oneof_with_base_schema import OneofWithBaseSchema from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -521,16 +501,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_oneof_with_base_schema_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_oneof_with_base_schema_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_oneof_with_base_schema_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_oneof_with_base_schema_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**OneofWithBaseSchema**](../../models/OneofWithBaseSchema.md) | | @@ -544,8 +524,6 @@ No authorization required # **post_oneof_with_empty_schema_request_body** -> post_oneof_with_empty_schema_request_body(oneof_with_empty_schema) - ### Example @@ -579,15 +557,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_oneof_with_empty_schema_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_oneof_with_empty_schema_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**OneofWithEmptySchema**](../../models/OneofWithEmptySchema.md) | | @@ -598,9 +576,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_oneof_with_empty_schema_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_oneof_with_empty_schema_request_body.response_for_200.ApiResponse) | success -#### post_oneof_with_empty_schema_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -615,8 +593,6 @@ No authorization required # **post_oneof_with_empty_schema_response_body_for_content_types** -> OneofWithEmptySchema post_oneof_with_empty_schema_response_body_for_content_types() - ### Example @@ -624,7 +600,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import one_of_api -from unit_test_api.model.oneof_with_empty_schema import OneofWithEmptySchema from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -652,16 +627,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_oneof_with_empty_schema_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_oneof_with_empty_schema_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_oneof_with_empty_schema_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_oneof_with_empty_schema_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**OneofWithEmptySchema**](../../models/OneofWithEmptySchema.md) | | @@ -675,8 +650,6 @@ No authorization required # **post_oneof_with_required_request_body** -> post_oneof_with_required_request_body(oneof_with_required) - ### Example @@ -710,15 +683,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_oneof_with_required_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_oneof_with_required_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**OneofWithRequired**](../../models/OneofWithRequired.md) | | @@ -729,9 +702,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_oneof_with_required_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_oneof_with_required_request_body.response_for_200.ApiResponse) | success -#### post_oneof_with_required_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -746,8 +719,6 @@ No authorization required # **post_oneof_with_required_response_body_for_content_types** -> OneofWithRequired post_oneof_with_required_response_body_for_content_types() - ### Example @@ -755,7 +726,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import one_of_api -from unit_test_api.model.oneof_with_required import OneofWithRequired from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -783,16 +753,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_oneof_with_required_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_oneof_with_required_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_oneof_with_required_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_oneof_with_required_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**OneofWithRequired**](../../models/OneofWithRequired.md) | | diff --git a/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/OperationRequestBodyApi.md b/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/OperationRequestBodyApi.md index b483f613cc3..0dd8ffcb6ed 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/OperationRequestBodyApi.md +++ b/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/OperationRequestBodyApi.md @@ -95,8 +95,6 @@ Method | HTTP request | Description # **post_additionalproperties_allows_a_schema_which_should_validate_request_body** -> post_additionalproperties_allows_a_schema_which_should_validate_request_body(additionalproperties_allows_a_schema_which_should_validate) - ### Example @@ -133,15 +131,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_additionalproperties_allows_a_schema_which_should_validate_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_additionalproperties_allows_a_schema_which_should_validate_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AdditionalpropertiesAllowsASchemaWhichShouldValidate**](../../models/AdditionalpropertiesAllowsASchemaWhichShouldValidate.md) | | @@ -152,9 +150,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_additionalproperties_allows_a_schema_which_should_validate_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_additionalproperties_allows_a_schema_which_should_validate_request_body.response_for_200.ApiResponse) | success -#### post_additionalproperties_allows_a_schema_which_should_validate_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -169,8 +167,6 @@ No authorization required # **post_additionalproperties_are_allowed_by_default_request_body** -> post_additionalproperties_are_allowed_by_default_request_body(additionalproperties_are_allowed_by_default) - ### Example @@ -204,15 +200,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_additionalproperties_are_allowed_by_default_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_additionalproperties_are_allowed_by_default_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AdditionalpropertiesAreAllowedByDefault**](../../models/AdditionalpropertiesAreAllowedByDefault.md) | | @@ -223,9 +219,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_additionalproperties_are_allowed_by_default_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_additionalproperties_are_allowed_by_default_request_body.response_for_200.ApiResponse) | success -#### post_additionalproperties_are_allowed_by_default_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -240,8 +236,6 @@ No authorization required # **post_additionalproperties_can_exist_by_itself_request_body** -> post_additionalproperties_can_exist_by_itself_request_body(additionalproperties_can_exist_by_itself) - ### Example @@ -277,15 +271,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_additionalproperties_can_exist_by_itself_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_additionalproperties_can_exist_by_itself_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AdditionalpropertiesCanExistByItself**](../../models/AdditionalpropertiesCanExistByItself.md) | | @@ -296,9 +290,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_additionalproperties_can_exist_by_itself_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_additionalproperties_can_exist_by_itself_request_body.response_for_200.ApiResponse) | success -#### post_additionalproperties_can_exist_by_itself_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -313,8 +307,6 @@ No authorization required # **post_additionalproperties_should_not_look_in_applicators_request_body** -> post_additionalproperties_should_not_look_in_applicators_request_body(additionalproperties_should_not_look_in_applicators) - ### Example @@ -348,15 +340,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_additionalproperties_should_not_look_in_applicators_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_additionalproperties_should_not_look_in_applicators_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AdditionalpropertiesShouldNotLookInApplicators**](../../models/AdditionalpropertiesShouldNotLookInApplicators.md) | | @@ -367,9 +359,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_additionalproperties_should_not_look_in_applicators_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_additionalproperties_should_not_look_in_applicators_request_body.response_for_200.ApiResponse) | success -#### post_additionalproperties_should_not_look_in_applicators_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -384,8 +376,6 @@ No authorization required # **post_allof_combined_with_anyof_oneof_request_body** -> post_allof_combined_with_anyof_oneof_request_body(allof_combined_with_anyof_oneof) - ### Example @@ -419,15 +409,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_allof_combined_with_anyof_oneof_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_allof_combined_with_anyof_oneof_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AllofCombinedWithAnyofOneof**](../../models/AllofCombinedWithAnyofOneof.md) | | @@ -438,9 +428,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_allof_combined_with_anyof_oneof_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_allof_combined_with_anyof_oneof_request_body.response_for_200.ApiResponse) | success -#### post_allof_combined_with_anyof_oneof_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -455,8 +445,6 @@ No authorization required # **post_allof_request_body** -> post_allof_request_body(allof) - ### Example @@ -490,15 +478,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_allof_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_allof_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**Allof**](../../models/Allof.md) | | @@ -509,9 +497,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_allof_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_allof_request_body.response_for_200.ApiResponse) | success -#### post_allof_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -526,8 +514,6 @@ No authorization required # **post_allof_simple_types_request_body** -> post_allof_simple_types_request_body(allof_simple_types) - ### Example @@ -561,15 +547,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_allof_simple_types_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_allof_simple_types_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AllofSimpleTypes**](../../models/AllofSimpleTypes.md) | | @@ -580,9 +566,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_allof_simple_types_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_allof_simple_types_request_body.response_for_200.ApiResponse) | success -#### post_allof_simple_types_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -597,8 +583,6 @@ No authorization required # **post_allof_with_base_schema_request_body** -> post_allof_with_base_schema_request_body(allof_with_base_schema) - ### Example @@ -632,15 +616,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_allof_with_base_schema_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_allof_with_base_schema_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AllofWithBaseSchema**](../../models/AllofWithBaseSchema.md) | | @@ -651,9 +635,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_allof_with_base_schema_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_allof_with_base_schema_request_body.response_for_200.ApiResponse) | success -#### post_allof_with_base_schema_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -668,8 +652,6 @@ No authorization required # **post_allof_with_one_empty_schema_request_body** -> post_allof_with_one_empty_schema_request_body(allof_with_one_empty_schema) - ### Example @@ -703,15 +685,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_allof_with_one_empty_schema_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_allof_with_one_empty_schema_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AllofWithOneEmptySchema**](../../models/AllofWithOneEmptySchema.md) | | @@ -722,9 +704,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_allof_with_one_empty_schema_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_allof_with_one_empty_schema_request_body.response_for_200.ApiResponse) | success -#### post_allof_with_one_empty_schema_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -739,8 +721,6 @@ No authorization required # **post_allof_with_the_first_empty_schema_request_body** -> post_allof_with_the_first_empty_schema_request_body(allof_with_the_first_empty_schema) - ### Example @@ -774,15 +754,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_allof_with_the_first_empty_schema_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_allof_with_the_first_empty_schema_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AllofWithTheFirstEmptySchema**](../../models/AllofWithTheFirstEmptySchema.md) | | @@ -793,9 +773,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_allof_with_the_first_empty_schema_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_allof_with_the_first_empty_schema_request_body.response_for_200.ApiResponse) | success -#### post_allof_with_the_first_empty_schema_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -810,8 +790,6 @@ No authorization required # **post_allof_with_the_last_empty_schema_request_body** -> post_allof_with_the_last_empty_schema_request_body(allof_with_the_last_empty_schema) - ### Example @@ -845,15 +823,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_allof_with_the_last_empty_schema_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_allof_with_the_last_empty_schema_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AllofWithTheLastEmptySchema**](../../models/AllofWithTheLastEmptySchema.md) | | @@ -864,9 +842,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_allof_with_the_last_empty_schema_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_allof_with_the_last_empty_schema_request_body.response_for_200.ApiResponse) | success -#### post_allof_with_the_last_empty_schema_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -881,8 +859,6 @@ No authorization required # **post_allof_with_two_empty_schemas_request_body** -> post_allof_with_two_empty_schemas_request_body(allof_with_two_empty_schemas) - ### Example @@ -916,15 +892,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_allof_with_two_empty_schemas_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_allof_with_two_empty_schemas_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AllofWithTwoEmptySchemas**](../../models/AllofWithTwoEmptySchemas.md) | | @@ -935,9 +911,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_allof_with_two_empty_schemas_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_allof_with_two_empty_schemas_request_body.response_for_200.ApiResponse) | success -#### post_allof_with_two_empty_schemas_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -952,8 +928,6 @@ No authorization required # **post_anyof_complex_types_request_body** -> post_anyof_complex_types_request_body(anyof_complex_types) - ### Example @@ -987,15 +961,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_anyof_complex_types_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_anyof_complex_types_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AnyofComplexTypes**](../../models/AnyofComplexTypes.md) | | @@ -1006,9 +980,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_anyof_complex_types_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_anyof_complex_types_request_body.response_for_200.ApiResponse) | success -#### post_anyof_complex_types_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -1023,8 +997,6 @@ No authorization required # **post_anyof_request_body** -> post_anyof_request_body(anyof) - ### Example @@ -1058,15 +1030,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_anyof_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_anyof_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**Anyof**](../../models/Anyof.md) | | @@ -1077,9 +1049,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_anyof_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_anyof_request_body.response_for_200.ApiResponse) | success -#### post_anyof_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -1094,8 +1066,6 @@ No authorization required # **post_anyof_with_base_schema_request_body** -> post_anyof_with_base_schema_request_body(body) - ### Example @@ -1129,15 +1099,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_anyof_with_base_schema_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_anyof_with_base_schema_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AnyofWithBaseSchema**](../../models/AnyofWithBaseSchema.md) | | @@ -1148,9 +1118,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_anyof_with_base_schema_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_anyof_with_base_schema_request_body.response_for_200.ApiResponse) | success -#### post_anyof_with_base_schema_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -1165,8 +1135,6 @@ No authorization required # **post_anyof_with_one_empty_schema_request_body** -> post_anyof_with_one_empty_schema_request_body(anyof_with_one_empty_schema) - ### Example @@ -1200,15 +1168,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_anyof_with_one_empty_schema_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_anyof_with_one_empty_schema_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AnyofWithOneEmptySchema**](../../models/AnyofWithOneEmptySchema.md) | | @@ -1219,9 +1187,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_anyof_with_one_empty_schema_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_anyof_with_one_empty_schema_request_body.response_for_200.ApiResponse) | success -#### post_anyof_with_one_empty_schema_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -1236,8 +1204,6 @@ No authorization required # **post_array_type_matches_arrays_request_body** -> post_array_type_matches_arrays_request_body(array_type_matches_arrays) - ### Example @@ -1273,15 +1239,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_array_type_matches_arrays_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_array_type_matches_arrays_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**ArrayTypeMatchesArrays**](../../models/ArrayTypeMatchesArrays.md) | | @@ -1292,9 +1258,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_array_type_matches_arrays_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_array_type_matches_arrays_request_body.response_for_200.ApiResponse) | success -#### post_array_type_matches_arrays_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -1309,8 +1275,6 @@ No authorization required # **post_boolean_type_matches_booleans_request_body** -> post_boolean_type_matches_booleans_request_body(body) - ### Example @@ -1318,6 +1282,7 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import operation_request_body_api +from unit_test_api.model.boolean_type_matches_booleans import BooleanTypeMatchesBooleans from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -1331,7 +1296,7 @@ with unit_test_api.ApiClient(configuration) as api_client: api_instance = operation_request_body_api.OperationRequestBodyApi(api_client) # example passing only required values which don't have defaults set - body = True + body = BooleanTypeMatchesBooleans(True) try: api_response = api_instance.post_boolean_type_matches_booleans_request_body( body=body, @@ -1343,29 +1308,28 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_boolean_type_matches_booleans_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_boolean_type_matches_booleans_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**BooleanTypeMatchesBooleans**](../../models/BooleanTypeMatchesBooleans.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -bool, | BoolClass, | | ### Return Types, Responses Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_boolean_type_matches_booleans_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_boolean_type_matches_booleans_request_body.response_for_200.ApiResponse) | success -#### post_boolean_type_matches_booleans_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -1380,8 +1344,6 @@ No authorization required # **post_by_int_request_body** -> post_by_int_request_body(body) - ### Example @@ -1415,15 +1377,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_by_int_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_by_int_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**ByInt**](../../models/ByInt.md) | | @@ -1434,9 +1396,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_by_int_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_by_int_request_body.response_for_200.ApiResponse) | success -#### post_by_int_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -1451,8 +1413,6 @@ No authorization required # **post_by_number_request_body** -> post_by_number_request_body(body) - ### Example @@ -1486,15 +1446,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_by_number_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_by_number_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**ByNumber**](../../models/ByNumber.md) | | @@ -1505,9 +1465,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_by_number_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_by_number_request_body.response_for_200.ApiResponse) | success -#### post_by_number_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -1522,8 +1482,6 @@ No authorization required # **post_by_small_number_request_body** -> post_by_small_number_request_body(body) - ### Example @@ -1557,15 +1515,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_by_small_number_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_by_small_number_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**BySmallNumber**](../../models/BySmallNumber.md) | | @@ -1576,9 +1534,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_by_small_number_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_by_small_number_request_body.response_for_200.ApiResponse) | success -#### post_by_small_number_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -1593,8 +1551,6 @@ No authorization required # **post_date_time_format_request_body** -> post_date_time_format_request_body(body) - ### Example @@ -1602,6 +1558,7 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import operation_request_body_api +from unit_test_api.model.date_time_format import DateTimeFormat from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -1615,7 +1572,7 @@ with unit_test_api.ApiClient(configuration) as api_client: api_instance = operation_request_body_api.OperationRequestBodyApi(api_client) # example passing only required values which don't have defaults set - body = None + body = DateTimeFormat(None) try: api_response = api_instance.post_date_time_format_request_body( body=body, @@ -1627,29 +1584,28 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_date_time_format_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_date_time_format_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**DateTimeFormat**](../../models/DateTimeFormat.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, | frozendict.frozendict, str, decimal.Decimal, BoolClass, NoneClass, tuple, bytes, FileIO | | value must conform to RFC-3339 date-time ### Return Types, Responses Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_date_time_format_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_date_time_format_request_body.response_for_200.ApiResponse) | success -#### post_date_time_format_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -1664,8 +1620,6 @@ No authorization required # **post_email_format_request_body** -> post_email_format_request_body(body) - ### Example @@ -1673,6 +1627,7 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import operation_request_body_api +from unit_test_api.model.email_format import EmailFormat from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -1686,7 +1641,7 @@ with unit_test_api.ApiClient(configuration) as api_client: api_instance = operation_request_body_api.OperationRequestBodyApi(api_client) # example passing only required values which don't have defaults set - body = None + body = EmailFormat(None) try: api_response = api_instance.post_email_format_request_body( body=body, @@ -1698,29 +1653,28 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_email_format_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_email_format_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**EmailFormat**](../../models/EmailFormat.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, | frozendict.frozendict, str, decimal.Decimal, BoolClass, NoneClass, tuple, bytes, FileIO | | ### Return Types, Responses Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_email_format_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_email_format_request_body.response_for_200.ApiResponse) | success -#### post_email_format_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -1735,8 +1689,6 @@ No authorization required # **post_enum_with0_does_not_match_false_request_body** -> post_enum_with0_does_not_match_false_request_body(body) - ### Example @@ -1770,15 +1722,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_enum_with0_does_not_match_false_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_enum_with0_does_not_match_false_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**EnumWith0DoesNotMatchFalse**](../../models/EnumWith0DoesNotMatchFalse.md) | | @@ -1789,9 +1741,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_enum_with0_does_not_match_false_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_enum_with0_does_not_match_false_request_body.response_for_200.ApiResponse) | success -#### post_enum_with0_does_not_match_false_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -1806,8 +1758,6 @@ No authorization required # **post_enum_with1_does_not_match_true_request_body** -> post_enum_with1_does_not_match_true_request_body(body) - ### Example @@ -1841,15 +1791,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_enum_with1_does_not_match_true_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_enum_with1_does_not_match_true_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**EnumWith1DoesNotMatchTrue**](../../models/EnumWith1DoesNotMatchTrue.md) | | @@ -1860,9 +1810,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_enum_with1_does_not_match_true_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_enum_with1_does_not_match_true_request_body.response_for_200.ApiResponse) | success -#### post_enum_with1_does_not_match_true_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -1877,8 +1827,6 @@ No authorization required # **post_enum_with_escaped_characters_request_body** -> post_enum_with_escaped_characters_request_body(body) - ### Example @@ -1912,15 +1860,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_enum_with_escaped_characters_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_enum_with_escaped_characters_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**EnumWithEscapedCharacters**](../../models/EnumWithEscapedCharacters.md) | | @@ -1931,9 +1879,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_enum_with_escaped_characters_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_enum_with_escaped_characters_request_body.response_for_200.ApiResponse) | success -#### post_enum_with_escaped_characters_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -1948,8 +1896,6 @@ No authorization required # **post_enum_with_false_does_not_match0_request_body** -> post_enum_with_false_does_not_match0_request_body(body) - ### Example @@ -1983,15 +1929,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_enum_with_false_does_not_match0_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_enum_with_false_does_not_match0_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**EnumWithFalseDoesNotMatch0**](../../models/EnumWithFalseDoesNotMatch0.md) | | @@ -2002,9 +1948,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_enum_with_false_does_not_match0_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_enum_with_false_does_not_match0_request_body.response_for_200.ApiResponse) | success -#### post_enum_with_false_does_not_match0_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -2019,8 +1965,6 @@ No authorization required # **post_enum_with_true_does_not_match1_request_body** -> post_enum_with_true_does_not_match1_request_body(body) - ### Example @@ -2054,15 +1998,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_enum_with_true_does_not_match1_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_enum_with_true_does_not_match1_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**EnumWithTrueDoesNotMatch1**](../../models/EnumWithTrueDoesNotMatch1.md) | | @@ -2073,9 +2017,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_enum_with_true_does_not_match1_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_enum_with_true_does_not_match1_request_body.response_for_200.ApiResponse) | success -#### post_enum_with_true_does_not_match1_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -2090,8 +2034,6 @@ No authorization required # **post_enums_in_properties_request_body** -> post_enums_in_properties_request_body(enums_in_properties) - ### Example @@ -2128,15 +2070,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_enums_in_properties_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_enums_in_properties_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**EnumsInProperties**](../../models/EnumsInProperties.md) | | @@ -2147,9 +2089,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_enums_in_properties_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_enums_in_properties_request_body.response_for_200.ApiResponse) | success -#### post_enums_in_properties_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -2164,8 +2106,6 @@ No authorization required # **post_forbidden_property_request_body** -> post_forbidden_property_request_body(forbidden_property) - ### Example @@ -2199,15 +2139,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_forbidden_property_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_forbidden_property_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**ForbiddenProperty**](../../models/ForbiddenProperty.md) | | @@ -2218,9 +2158,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_forbidden_property_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_forbidden_property_request_body.response_for_200.ApiResponse) | success -#### post_forbidden_property_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -2235,8 +2175,6 @@ No authorization required # **post_hostname_format_request_body** -> post_hostname_format_request_body(body) - ### Example @@ -2244,6 +2182,7 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import operation_request_body_api +from unit_test_api.model.hostname_format import HostnameFormat from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -2257,7 +2196,7 @@ with unit_test_api.ApiClient(configuration) as api_client: api_instance = operation_request_body_api.OperationRequestBodyApi(api_client) # example passing only required values which don't have defaults set - body = None + body = HostnameFormat(None) try: api_response = api_instance.post_hostname_format_request_body( body=body, @@ -2269,29 +2208,28 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_hostname_format_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_hostname_format_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**HostnameFormat**](../../models/HostnameFormat.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, | frozendict.frozendict, str, decimal.Decimal, BoolClass, NoneClass, tuple, bytes, FileIO | | ### Return Types, Responses Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_hostname_format_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_hostname_format_request_body.response_for_200.ApiResponse) | success -#### post_hostname_format_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -2306,8 +2244,6 @@ No authorization required # **post_integer_type_matches_integers_request_body** -> post_integer_type_matches_integers_request_body(body) - ### Example @@ -2315,6 +2251,7 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import operation_request_body_api +from unit_test_api.model.integer_type_matches_integers import IntegerTypeMatchesIntegers from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -2328,7 +2265,7 @@ with unit_test_api.ApiClient(configuration) as api_client: api_instance = operation_request_body_api.OperationRequestBodyApi(api_client) # example passing only required values which don't have defaults set - body = 1 + body = IntegerTypeMatchesIntegers(1) try: api_response = api_instance.post_integer_type_matches_integers_request_body( body=body, @@ -2340,29 +2277,28 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_integer_type_matches_integers_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_integer_type_matches_integers_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**IntegerTypeMatchesIntegers**](../../models/IntegerTypeMatchesIntegers.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -decimal.Decimal, int, | decimal.Decimal, | | ### Return Types, Responses Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_integer_type_matches_integers_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_integer_type_matches_integers_request_body.response_for_200.ApiResponse) | success -#### post_integer_type_matches_integers_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -2377,8 +2313,6 @@ No authorization required # **post_invalid_instance_should_not_raise_error_when_float_division_inf_request_body** -> post_invalid_instance_should_not_raise_error_when_float_division_inf_request_body(body) - ### Example @@ -2412,15 +2346,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_invalid_instance_should_not_raise_error_when_float_division_inf_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_invalid_instance_should_not_raise_error_when_float_division_inf_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf**](../../models/InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf.md) | | @@ -2431,9 +2365,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_invalid_instance_should_not_raise_error_when_float_division_inf_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_invalid_instance_should_not_raise_error_when_float_division_inf_request_body.response_for_200.ApiResponse) | success -#### post_invalid_instance_should_not_raise_error_when_float_division_inf_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -2448,8 +2382,6 @@ No authorization required # **post_invalid_string_value_for_default_request_body** -> post_invalid_string_value_for_default_request_body(invalid_string_value_for_default) - ### Example @@ -2483,15 +2415,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_invalid_string_value_for_default_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_invalid_string_value_for_default_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**InvalidStringValueForDefault**](../../models/InvalidStringValueForDefault.md) | | @@ -2502,9 +2434,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_invalid_string_value_for_default_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_invalid_string_value_for_default_request_body.response_for_200.ApiResponse) | success -#### post_invalid_string_value_for_default_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -2519,8 +2451,6 @@ No authorization required # **post_ipv4_format_request_body** -> post_ipv4_format_request_body(body) - ### Example @@ -2528,6 +2458,7 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import operation_request_body_api +from unit_test_api.model.ipv4_format import Ipv4Format from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -2541,7 +2472,7 @@ with unit_test_api.ApiClient(configuration) as api_client: api_instance = operation_request_body_api.OperationRequestBodyApi(api_client) # example passing only required values which don't have defaults set - body = None + body = Ipv4Format(None) try: api_response = api_instance.post_ipv4_format_request_body( body=body, @@ -2553,29 +2484,28 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_ipv4_format_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_ipv4_format_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**Ipv4Format**](../../models/Ipv4Format.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, | frozendict.frozendict, str, decimal.Decimal, BoolClass, NoneClass, tuple, bytes, FileIO | | ### Return Types, Responses Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_ipv4_format_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_ipv4_format_request_body.response_for_200.ApiResponse) | success -#### post_ipv4_format_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -2590,8 +2520,6 @@ No authorization required # **post_ipv6_format_request_body** -> post_ipv6_format_request_body(body) - ### Example @@ -2599,6 +2527,7 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import operation_request_body_api +from unit_test_api.model.ipv6_format import Ipv6Format from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -2612,7 +2541,7 @@ with unit_test_api.ApiClient(configuration) as api_client: api_instance = operation_request_body_api.OperationRequestBodyApi(api_client) # example passing only required values which don't have defaults set - body = None + body = Ipv6Format(None) try: api_response = api_instance.post_ipv6_format_request_body( body=body, @@ -2624,29 +2553,28 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_ipv6_format_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_ipv6_format_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**Ipv6Format**](../../models/Ipv6Format.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, | frozendict.frozendict, str, decimal.Decimal, BoolClass, NoneClass, tuple, bytes, FileIO | | ### Return Types, Responses Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_ipv6_format_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_ipv6_format_request_body.response_for_200.ApiResponse) | success -#### post_ipv6_format_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -2661,8 +2589,6 @@ No authorization required # **post_json_pointer_format_request_body** -> post_json_pointer_format_request_body(body) - ### Example @@ -2670,6 +2596,7 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import operation_request_body_api +from unit_test_api.model.json_pointer_format import JsonPointerFormat from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -2683,7 +2610,7 @@ with unit_test_api.ApiClient(configuration) as api_client: api_instance = operation_request_body_api.OperationRequestBodyApi(api_client) # example passing only required values which don't have defaults set - body = None + body = JsonPointerFormat(None) try: api_response = api_instance.post_json_pointer_format_request_body( body=body, @@ -2695,29 +2622,28 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_json_pointer_format_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_json_pointer_format_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**JsonPointerFormat**](../../models/JsonPointerFormat.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, | frozendict.frozendict, str, decimal.Decimal, BoolClass, NoneClass, tuple, bytes, FileIO | | ### Return Types, Responses Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_json_pointer_format_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_json_pointer_format_request_body.response_for_200.ApiResponse) | success -#### post_json_pointer_format_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -2732,8 +2658,6 @@ No authorization required # **post_maximum_validation_request_body** -> post_maximum_validation_request_body(body) - ### Example @@ -2767,15 +2691,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_maximum_validation_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_maximum_validation_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**MaximumValidation**](../../models/MaximumValidation.md) | | @@ -2786,9 +2710,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_maximum_validation_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_maximum_validation_request_body.response_for_200.ApiResponse) | success -#### post_maximum_validation_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -2803,8 +2727,6 @@ No authorization required # **post_maximum_validation_with_unsigned_integer_request_body** -> post_maximum_validation_with_unsigned_integer_request_body(body) - ### Example @@ -2838,15 +2760,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_maximum_validation_with_unsigned_integer_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_maximum_validation_with_unsigned_integer_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**MaximumValidationWithUnsignedInteger**](../../models/MaximumValidationWithUnsignedInteger.md) | | @@ -2857,9 +2779,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_maximum_validation_with_unsigned_integer_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_maximum_validation_with_unsigned_integer_request_body.response_for_200.ApiResponse) | success -#### post_maximum_validation_with_unsigned_integer_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -2874,8 +2796,6 @@ No authorization required # **post_maxitems_validation_request_body** -> post_maxitems_validation_request_body(body) - ### Example @@ -2909,15 +2829,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_maxitems_validation_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_maxitems_validation_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**MaxitemsValidation**](../../models/MaxitemsValidation.md) | | @@ -2928,9 +2848,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_maxitems_validation_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_maxitems_validation_request_body.response_for_200.ApiResponse) | success -#### post_maxitems_validation_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -2945,8 +2865,6 @@ No authorization required # **post_maxlength_validation_request_body** -> post_maxlength_validation_request_body(body) - ### Example @@ -2980,15 +2898,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_maxlength_validation_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_maxlength_validation_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**MaxlengthValidation**](../../models/MaxlengthValidation.md) | | @@ -2999,9 +2917,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_maxlength_validation_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_maxlength_validation_request_body.response_for_200.ApiResponse) | success -#### post_maxlength_validation_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -3016,8 +2934,6 @@ No authorization required # **post_maxproperties0_means_the_object_is_empty_request_body** -> post_maxproperties0_means_the_object_is_empty_request_body(body) - ### Example @@ -3051,15 +2967,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_maxproperties0_means_the_object_is_empty_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_maxproperties0_means_the_object_is_empty_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**Maxproperties0MeansTheObjectIsEmpty**](../../models/Maxproperties0MeansTheObjectIsEmpty.md) | | @@ -3070,9 +2986,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_maxproperties0_means_the_object_is_empty_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_maxproperties0_means_the_object_is_empty_request_body.response_for_200.ApiResponse) | success -#### post_maxproperties0_means_the_object_is_empty_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -3087,8 +3003,6 @@ No authorization required # **post_maxproperties_validation_request_body** -> post_maxproperties_validation_request_body(body) - ### Example @@ -3122,15 +3036,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_maxproperties_validation_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_maxproperties_validation_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**MaxpropertiesValidation**](../../models/MaxpropertiesValidation.md) | | @@ -3141,9 +3055,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_maxproperties_validation_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_maxproperties_validation_request_body.response_for_200.ApiResponse) | success -#### post_maxproperties_validation_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -3158,8 +3072,6 @@ No authorization required # **post_minimum_validation_request_body** -> post_minimum_validation_request_body(body) - ### Example @@ -3193,15 +3105,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_minimum_validation_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_minimum_validation_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**MinimumValidation**](../../models/MinimumValidation.md) | | @@ -3212,9 +3124,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_minimum_validation_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_minimum_validation_request_body.response_for_200.ApiResponse) | success -#### post_minimum_validation_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -3229,8 +3141,6 @@ No authorization required # **post_minimum_validation_with_signed_integer_request_body** -> post_minimum_validation_with_signed_integer_request_body(body) - ### Example @@ -3264,15 +3174,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_minimum_validation_with_signed_integer_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_minimum_validation_with_signed_integer_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**MinimumValidationWithSignedInteger**](../../models/MinimumValidationWithSignedInteger.md) | | @@ -3283,9 +3193,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_minimum_validation_with_signed_integer_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_minimum_validation_with_signed_integer_request_body.response_for_200.ApiResponse) | success -#### post_minimum_validation_with_signed_integer_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -3300,8 +3210,6 @@ No authorization required # **post_minitems_validation_request_body** -> post_minitems_validation_request_body(body) - ### Example @@ -3335,15 +3243,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_minitems_validation_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_minitems_validation_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**MinitemsValidation**](../../models/MinitemsValidation.md) | | @@ -3354,9 +3262,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_minitems_validation_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_minitems_validation_request_body.response_for_200.ApiResponse) | success -#### post_minitems_validation_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -3371,8 +3279,6 @@ No authorization required # **post_minlength_validation_request_body** -> post_minlength_validation_request_body(body) - ### Example @@ -3406,15 +3312,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_minlength_validation_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_minlength_validation_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**MinlengthValidation**](../../models/MinlengthValidation.md) | | @@ -3425,9 +3331,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_minlength_validation_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_minlength_validation_request_body.response_for_200.ApiResponse) | success -#### post_minlength_validation_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -3442,8 +3348,6 @@ No authorization required # **post_minproperties_validation_request_body** -> post_minproperties_validation_request_body(body) - ### Example @@ -3477,15 +3381,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_minproperties_validation_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_minproperties_validation_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**MinpropertiesValidation**](../../models/MinpropertiesValidation.md) | | @@ -3496,9 +3400,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_minproperties_validation_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_minproperties_validation_request_body.response_for_200.ApiResponse) | success -#### post_minproperties_validation_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -3513,8 +3417,6 @@ No authorization required # **post_nested_allof_to_check_validation_semantics_request_body** -> post_nested_allof_to_check_validation_semantics_request_body(nested_allof_to_check_validation_semantics) - ### Example @@ -3548,15 +3450,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_nested_allof_to_check_validation_semantics_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_nested_allof_to_check_validation_semantics_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**NestedAllofToCheckValidationSemantics**](../../models/NestedAllofToCheckValidationSemantics.md) | | @@ -3567,9 +3469,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_nested_allof_to_check_validation_semantics_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_nested_allof_to_check_validation_semantics_request_body.response_for_200.ApiResponse) | success -#### post_nested_allof_to_check_validation_semantics_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -3584,8 +3486,6 @@ No authorization required # **post_nested_anyof_to_check_validation_semantics_request_body** -> post_nested_anyof_to_check_validation_semantics_request_body(nested_anyof_to_check_validation_semantics) - ### Example @@ -3619,15 +3519,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_nested_anyof_to_check_validation_semantics_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_nested_anyof_to_check_validation_semantics_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**NestedAnyofToCheckValidationSemantics**](../../models/NestedAnyofToCheckValidationSemantics.md) | | @@ -3638,9 +3538,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_nested_anyof_to_check_validation_semantics_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_nested_anyof_to_check_validation_semantics_request_body.response_for_200.ApiResponse) | success -#### post_nested_anyof_to_check_validation_semantics_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -3655,8 +3555,6 @@ No authorization required # **post_nested_items_request_body** -> post_nested_items_request_body(nested_items) - ### Example @@ -3698,15 +3596,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_nested_items_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_nested_items_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**NestedItems**](../../models/NestedItems.md) | | @@ -3717,9 +3615,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_nested_items_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_nested_items_request_body.response_for_200.ApiResponse) | success -#### post_nested_items_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -3734,8 +3632,6 @@ No authorization required # **post_nested_oneof_to_check_validation_semantics_request_body** -> post_nested_oneof_to_check_validation_semantics_request_body(nested_oneof_to_check_validation_semantics) - ### Example @@ -3769,15 +3665,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_nested_oneof_to_check_validation_semantics_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_nested_oneof_to_check_validation_semantics_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**NestedOneofToCheckValidationSemantics**](../../models/NestedOneofToCheckValidationSemantics.md) | | @@ -3788,9 +3684,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_nested_oneof_to_check_validation_semantics_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_nested_oneof_to_check_validation_semantics_request_body.response_for_200.ApiResponse) | success -#### post_nested_oneof_to_check_validation_semantics_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -3805,8 +3701,6 @@ No authorization required # **post_not_more_complex_schema_request_body** -> post_not_more_complex_schema_request_body(body) - ### Example @@ -3814,6 +3708,7 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import operation_request_body_api +from unit_test_api.model.not_more_complex_schema import NotMoreComplexSchema from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -3827,7 +3722,7 @@ with unit_test_api.ApiClient(configuration) as api_client: api_instance = operation_request_body_api.OperationRequestBodyApi(api_client) # example passing only required values which don't have defaults set - body = None + body = NotMoreComplexSchema(None) try: api_response = api_instance.post_not_more_complex_schema_request_body( body=body, @@ -3839,48 +3734,28 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_not_more_complex_schema_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_not_more_complex_schema_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body - -# SchemaForRequestBodyApplicationJson - -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, | frozendict.frozendict, str, decimal.Decimal, BoolClass, NoneClass, tuple, bytes, FileIO | | - -### Composed Schemas (allOf/anyOf/oneOf/not) -#### not -Class Name | Input Type | Accessed Type | Description | Notes -------------- | ------------- | ------------- | ------------- | ------------- -[not_schema](#not_schema) | dict, frozendict.frozendict, | frozendict.frozendict, | | +### body -# not_schema - -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, | frozendict.frozendict, | | +# RequestBody.Schemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**NotMoreComplexSchema**](../../models/NotMoreComplexSchema.md) | | -### Dictionary Keys -Key | Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- | ------------- -**foo** | str, | str, | | [optional] -**any_string_name** | dict, frozendict.frozendict, str, date, datetime, int, float, bool, decimal.Decimal, None, list, tuple, bytes, io.FileIO, io.BufferedReader | frozendict.frozendict, str, BoolClass, decimal.Decimal, NoneClass, tuple, bytes, FileIO | any string name can be used but the value must be the correct type | [optional] ### Return Types, Responses Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_not_more_complex_schema_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_not_more_complex_schema_request_body.response_for_200.ApiResponse) | success -#### post_not_more_complex_schema_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -3895,8 +3770,6 @@ No authorization required # **post_not_request_body** -> post_not_request_body(body) - ### Example @@ -3904,6 +3777,7 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import operation_request_body_api +from unit_test_api.model.model_not import ModelNot from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -3917,7 +3791,7 @@ with unit_test_api.ApiClient(configuration) as api_client: api_instance = operation_request_body_api.OperationRequestBodyApi(api_client) # example passing only required values which don't have defaults set - body = None + body = ModelNot(None) try: api_response = api_instance.post_not_request_body( body=body, @@ -3929,42 +3803,28 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_not_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_not_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson - -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, | frozendict.frozendict, str, decimal.Decimal, BoolClass, NoneClass, tuple, bytes, FileIO | | - -### Composed Schemas (allOf/anyOf/oneOf/not) -#### not -Class Name | Input Type | Accessed Type | Description | Notes -------------- | ------------- | ------------- | ------------- | ------------- -[not_schema](#not_schema) | decimal.Decimal, int, | decimal.Decimal, | | - -# not_schema +# RequestBody.Schemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**ModelNot**](../../models/ModelNot.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -decimal.Decimal, int, | decimal.Decimal, | | ### Return Types, Responses Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_not_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_not_request_body.response_for_200.ApiResponse) | success -#### post_not_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -3979,8 +3839,6 @@ No authorization required # **post_nul_characters_in_strings_request_body** -> post_nul_characters_in_strings_request_body(body) - ### Example @@ -4014,15 +3872,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_nul_characters_in_strings_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_nul_characters_in_strings_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**NulCharactersInStrings**](../../models/NulCharactersInStrings.md) | | @@ -4033,9 +3891,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_nul_characters_in_strings_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_nul_characters_in_strings_request_body.response_for_200.ApiResponse) | success -#### post_nul_characters_in_strings_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -4050,8 +3908,6 @@ No authorization required # **post_null_type_matches_only_the_null_object_request_body** -> post_null_type_matches_only_the_null_object_request_body(body) - ### Example @@ -4059,6 +3915,7 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import operation_request_body_api +from unit_test_api.model.null_type_matches_only_the_null_object import NullTypeMatchesOnlyTheNullObject from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -4072,7 +3929,7 @@ with unit_test_api.ApiClient(configuration) as api_client: api_instance = operation_request_body_api.OperationRequestBodyApi(api_client) # example passing only required values which don't have defaults set - body = None + body = NullTypeMatchesOnlyTheNullObject(None) try: api_response = api_instance.post_null_type_matches_only_the_null_object_request_body( body=body, @@ -4084,29 +3941,28 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_null_type_matches_only_the_null_object_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_null_type_matches_only_the_null_object_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**NullTypeMatchesOnlyTheNullObject**](../../models/NullTypeMatchesOnlyTheNullObject.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -None, | NoneClass, | | ### Return Types, Responses Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_null_type_matches_only_the_null_object_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_null_type_matches_only_the_null_object_request_body.response_for_200.ApiResponse) | success -#### post_null_type_matches_only_the_null_object_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -4121,8 +3977,6 @@ No authorization required # **post_number_type_matches_numbers_request_body** -> post_number_type_matches_numbers_request_body(body) - ### Example @@ -4130,6 +3984,7 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import operation_request_body_api +from unit_test_api.model.number_type_matches_numbers import NumberTypeMatchesNumbers from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -4143,7 +3998,7 @@ with unit_test_api.ApiClient(configuration) as api_client: api_instance = operation_request_body_api.OperationRequestBodyApi(api_client) # example passing only required values which don't have defaults set - body = 3.14 + body = NumberTypeMatchesNumbers(3.14) try: api_response = api_instance.post_number_type_matches_numbers_request_body( body=body, @@ -4155,29 +4010,28 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_number_type_matches_numbers_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_number_type_matches_numbers_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**NumberTypeMatchesNumbers**](../../models/NumberTypeMatchesNumbers.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -decimal.Decimal, int, float, | decimal.Decimal, | | ### Return Types, Responses Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_number_type_matches_numbers_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_number_type_matches_numbers_request_body.response_for_200.ApiResponse) | success -#### post_number_type_matches_numbers_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -4192,8 +4046,6 @@ No authorization required # **post_object_properties_validation_request_body** -> post_object_properties_validation_request_body(object_properties_validation) - ### Example @@ -4227,15 +4079,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_object_properties_validation_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_object_properties_validation_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**ObjectPropertiesValidation**](../../models/ObjectPropertiesValidation.md) | | @@ -4246,9 +4098,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_object_properties_validation_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_object_properties_validation_request_body.response_for_200.ApiResponse) | success -#### post_object_properties_validation_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -4263,8 +4115,6 @@ No authorization required # **post_object_type_matches_objects_request_body** -> post_object_type_matches_objects_request_body(body) - ### Example @@ -4272,6 +4122,7 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import operation_request_body_api +from unit_test_api.model.object_type_matches_objects import ObjectTypeMatchesObjects from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -4285,7 +4136,7 @@ with unit_test_api.ApiClient(configuration) as api_client: api_instance = operation_request_body_api.OperationRequestBodyApi(api_client) # example passing only required values which don't have defaults set - body = dict() + body = ObjectTypeMatchesObjects() try: api_response = api_instance.post_object_type_matches_objects_request_body( body=body, @@ -4297,29 +4148,28 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_object_type_matches_objects_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_object_type_matches_objects_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**ObjectTypeMatchesObjects**](../../models/ObjectTypeMatchesObjects.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, | frozendict.frozendict, | | ### Return Types, Responses Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_object_type_matches_objects_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_object_type_matches_objects_request_body.response_for_200.ApiResponse) | success -#### post_object_type_matches_objects_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -4334,8 +4184,6 @@ No authorization required # **post_oneof_complex_types_request_body** -> post_oneof_complex_types_request_body(oneof_complex_types) - ### Example @@ -4369,15 +4217,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_oneof_complex_types_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_oneof_complex_types_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**OneofComplexTypes**](../../models/OneofComplexTypes.md) | | @@ -4388,9 +4236,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_oneof_complex_types_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_oneof_complex_types_request_body.response_for_200.ApiResponse) | success -#### post_oneof_complex_types_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -4405,8 +4253,6 @@ No authorization required # **post_oneof_request_body** -> post_oneof_request_body(oneof) - ### Example @@ -4440,15 +4286,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_oneof_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_oneof_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**Oneof**](../../models/Oneof.md) | | @@ -4459,9 +4305,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_oneof_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_oneof_request_body.response_for_200.ApiResponse) | success -#### post_oneof_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -4476,8 +4322,6 @@ No authorization required # **post_oneof_with_base_schema_request_body** -> post_oneof_with_base_schema_request_body(body) - ### Example @@ -4511,15 +4355,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_oneof_with_base_schema_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_oneof_with_base_schema_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**OneofWithBaseSchema**](../../models/OneofWithBaseSchema.md) | | @@ -4530,9 +4374,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_oneof_with_base_schema_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_oneof_with_base_schema_request_body.response_for_200.ApiResponse) | success -#### post_oneof_with_base_schema_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -4547,8 +4391,6 @@ No authorization required # **post_oneof_with_empty_schema_request_body** -> post_oneof_with_empty_schema_request_body(oneof_with_empty_schema) - ### Example @@ -4582,15 +4424,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_oneof_with_empty_schema_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_oneof_with_empty_schema_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**OneofWithEmptySchema**](../../models/OneofWithEmptySchema.md) | | @@ -4601,9 +4443,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_oneof_with_empty_schema_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_oneof_with_empty_schema_request_body.response_for_200.ApiResponse) | success -#### post_oneof_with_empty_schema_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -4618,8 +4460,6 @@ No authorization required # **post_oneof_with_required_request_body** -> post_oneof_with_required_request_body(oneof_with_required) - ### Example @@ -4653,15 +4493,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_oneof_with_required_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_oneof_with_required_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**OneofWithRequired**](../../models/OneofWithRequired.md) | | @@ -4672,9 +4512,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_oneof_with_required_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_oneof_with_required_request_body.response_for_200.ApiResponse) | success -#### post_oneof_with_required_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -4689,8 +4529,6 @@ No authorization required # **post_pattern_is_not_anchored_request_body** -> post_pattern_is_not_anchored_request_body(body) - ### Example @@ -4724,15 +4562,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_pattern_is_not_anchored_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_pattern_is_not_anchored_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**PatternIsNotAnchored**](../../models/PatternIsNotAnchored.md) | | @@ -4743,9 +4581,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_pattern_is_not_anchored_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_pattern_is_not_anchored_request_body.response_for_200.ApiResponse) | success -#### post_pattern_is_not_anchored_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -4760,8 +4598,6 @@ No authorization required # **post_pattern_validation_request_body** -> post_pattern_validation_request_body(body) - ### Example @@ -4795,15 +4631,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_pattern_validation_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_pattern_validation_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**PatternValidation**](../../models/PatternValidation.md) | | @@ -4814,9 +4650,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_pattern_validation_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_pattern_validation_request_body.response_for_200.ApiResponse) | success -#### post_pattern_validation_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -4831,8 +4667,6 @@ No authorization required # **post_properties_with_escaped_characters_request_body** -> post_properties_with_escaped_characters_request_body(properties_with_escaped_characters) - ### Example @@ -4866,15 +4700,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_properties_with_escaped_characters_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_properties_with_escaped_characters_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**PropertiesWithEscapedCharacters**](../../models/PropertiesWithEscapedCharacters.md) | | @@ -4885,9 +4719,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_properties_with_escaped_characters_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_properties_with_escaped_characters_request_body.response_for_200.ApiResponse) | success -#### post_properties_with_escaped_characters_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -4902,8 +4736,6 @@ No authorization required # **post_property_named_ref_that_is_not_a_reference_request_body** -> post_property_named_ref_that_is_not_a_reference_request_body(property_named_ref_that_is_not_a_reference) - ### Example @@ -4937,15 +4769,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_property_named_ref_that_is_not_a_reference_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_property_named_ref_that_is_not_a_reference_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**PropertyNamedRefThatIsNotAReference**](../../models/PropertyNamedRefThatIsNotAReference.md) | | @@ -4956,9 +4788,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_property_named_ref_that_is_not_a_reference_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_property_named_ref_that_is_not_a_reference_request_body.response_for_200.ApiResponse) | success -#### post_property_named_ref_that_is_not_a_reference_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -4973,8 +4805,6 @@ No authorization required # **post_ref_in_additionalproperties_request_body** -> post_ref_in_additionalproperties_request_body(ref_in_additionalproperties) - ### Example @@ -5010,15 +4840,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_ref_in_additionalproperties_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_ref_in_additionalproperties_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**RefInAdditionalproperties**](../../models/RefInAdditionalproperties.md) | | @@ -5029,9 +4859,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_ref_in_additionalproperties_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_ref_in_additionalproperties_request_body.response_for_200.ApiResponse) | success -#### post_ref_in_additionalproperties_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -5046,8 +4876,6 @@ No authorization required # **post_ref_in_allof_request_body** -> post_ref_in_allof_request_body(ref_in_allof) - ### Example @@ -5081,15 +4909,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_ref_in_allof_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_ref_in_allof_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**RefInAllof**](../../models/RefInAllof.md) | | @@ -5100,9 +4928,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_ref_in_allof_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_ref_in_allof_request_body.response_for_200.ApiResponse) | success -#### post_ref_in_allof_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -5117,8 +4945,6 @@ No authorization required # **post_ref_in_anyof_request_body** -> post_ref_in_anyof_request_body(ref_in_anyof) - ### Example @@ -5152,15 +4978,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_ref_in_anyof_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_ref_in_anyof_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**RefInAnyof**](../../models/RefInAnyof.md) | | @@ -5171,9 +4997,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_ref_in_anyof_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_ref_in_anyof_request_body.response_for_200.ApiResponse) | success -#### post_ref_in_anyof_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -5188,8 +5014,6 @@ No authorization required # **post_ref_in_items_request_body** -> post_ref_in_items_request_body(ref_in_items) - ### Example @@ -5225,15 +5049,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_ref_in_items_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_ref_in_items_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**RefInItems**](../../models/RefInItems.md) | | @@ -5244,9 +5068,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_ref_in_items_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_ref_in_items_request_body.response_for_200.ApiResponse) | success -#### post_ref_in_items_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -5261,8 +5085,6 @@ No authorization required # **post_ref_in_not_request_body** -> post_ref_in_not_request_body(body) - ### Example @@ -5270,7 +5092,7 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import operation_request_body_api -from unit_test_api.model.property_named_ref_that_is_not_a_reference import PropertyNamedRefThatIsNotAReference +from unit_test_api.model.ref_in_not import RefInNot from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -5284,7 +5106,7 @@ with unit_test_api.ApiClient(configuration) as api_client: api_instance = operation_request_body_api.OperationRequestBodyApi(api_client) # example passing only required values which don't have defaults set - body = None + body = RefInNot(None) try: api_response = api_instance.post_ref_in_not_request_body( body=body, @@ -5296,35 +5118,28 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_ref_in_not_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_ref_in_not_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body - -# SchemaForRequestBodyApplicationJson +### body -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, | frozendict.frozendict, str, decimal.Decimal, BoolClass, NoneClass, tuple, bytes, FileIO | | +# RequestBody.Schemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**RefInNot**](../../models/RefInNot.md) | | -### Composed Schemas (allOf/anyOf/oneOf/not) -#### not -Class Name | Input Type | Accessed Type | Description | Notes -------------- | ------------- | ------------- | ------------- | ------------- -[PropertyNamedRefThatIsNotAReference]({{complexTypePrefix}}PropertyNamedRefThatIsNotAReference.md) | [**PropertyNamedRefThatIsNotAReference**]({{complexTypePrefix}}PropertyNamedRefThatIsNotAReference.md) | [**PropertyNamedRefThatIsNotAReference**]({{complexTypePrefix}}PropertyNamedRefThatIsNotAReference.md) | | ### Return Types, Responses Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_ref_in_not_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_ref_in_not_request_body.response_for_200.ApiResponse) | success -#### post_ref_in_not_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -5339,8 +5154,6 @@ No authorization required # **post_ref_in_oneof_request_body** -> post_ref_in_oneof_request_body(ref_in_oneof) - ### Example @@ -5374,15 +5187,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_ref_in_oneof_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_ref_in_oneof_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**RefInOneof**](../../models/RefInOneof.md) | | @@ -5393,9 +5206,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_ref_in_oneof_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_ref_in_oneof_request_body.response_for_200.ApiResponse) | success -#### post_ref_in_oneof_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -5410,8 +5223,6 @@ No authorization required # **post_ref_in_property_request_body** -> post_ref_in_property_request_body(ref_in_property) - ### Example @@ -5445,15 +5256,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_ref_in_property_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_ref_in_property_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**RefInProperty**](../../models/RefInProperty.md) | | @@ -5464,9 +5275,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_ref_in_property_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_ref_in_property_request_body.response_for_200.ApiResponse) | success -#### post_ref_in_property_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -5481,8 +5292,6 @@ No authorization required # **post_required_default_validation_request_body** -> post_required_default_validation_request_body(required_default_validation) - ### Example @@ -5516,15 +5325,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_required_default_validation_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_required_default_validation_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**RequiredDefaultValidation**](../../models/RequiredDefaultValidation.md) | | @@ -5535,9 +5344,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_required_default_validation_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_required_default_validation_request_body.response_for_200.ApiResponse) | success -#### post_required_default_validation_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -5552,8 +5361,6 @@ No authorization required # **post_required_validation_request_body** -> post_required_validation_request_body(required_validation) - ### Example @@ -5587,15 +5394,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_required_validation_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_required_validation_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**RequiredValidation**](../../models/RequiredValidation.md) | | @@ -5606,9 +5413,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_required_validation_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_required_validation_request_body.response_for_200.ApiResponse) | success -#### post_required_validation_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -5623,8 +5430,6 @@ No authorization required # **post_required_with_empty_array_request_body** -> post_required_with_empty_array_request_body(required_with_empty_array) - ### Example @@ -5658,15 +5463,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_required_with_empty_array_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_required_with_empty_array_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**RequiredWithEmptyArray**](../../models/RequiredWithEmptyArray.md) | | @@ -5677,9 +5482,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_required_with_empty_array_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_required_with_empty_array_request_body.response_for_200.ApiResponse) | success -#### post_required_with_empty_array_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -5694,8 +5499,6 @@ No authorization required # **post_required_with_escaped_characters_request_body** -> post_required_with_escaped_characters_request_body(body) - ### Example @@ -5703,6 +5506,7 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import operation_request_body_api +from unit_test_api.model.required_with_escaped_characters import RequiredWithEscapedCharacters from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -5716,7 +5520,7 @@ with unit_test_api.ApiClient(configuration) as api_client: api_instance = operation_request_body_api.OperationRequestBodyApi(api_client) # example passing only required values which don't have defaults set - body = None + body = RequiredWithEscapedCharacters(None) try: api_response = api_instance.post_required_with_escaped_characters_request_body( body=body, @@ -5728,29 +5532,28 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_required_with_escaped_characters_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_required_with_escaped_characters_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**RequiredWithEscapedCharacters**](../../models/RequiredWithEscapedCharacters.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, | frozendict.frozendict, str, decimal.Decimal, BoolClass, NoneClass, tuple, bytes, FileIO | | ### Return Types, Responses Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_required_with_escaped_characters_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_required_with_escaped_characters_request_body.response_for_200.ApiResponse) | success -#### post_required_with_escaped_characters_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -5765,8 +5568,6 @@ No authorization required # **post_simple_enum_validation_request_body** -> post_simple_enum_validation_request_body(body) - ### Example @@ -5800,15 +5601,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_simple_enum_validation_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_simple_enum_validation_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**SimpleEnumValidation**](../../models/SimpleEnumValidation.md) | | @@ -5819,9 +5620,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_simple_enum_validation_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_simple_enum_validation_request_body.response_for_200.ApiResponse) | success -#### post_simple_enum_validation_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -5836,8 +5637,6 @@ No authorization required # **post_string_type_matches_strings_request_body** -> post_string_type_matches_strings_request_body(body) - ### Example @@ -5845,6 +5644,7 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import operation_request_body_api +from unit_test_api.model.string_type_matches_strings import StringTypeMatchesStrings from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -5858,7 +5658,7 @@ with unit_test_api.ApiClient(configuration) as api_client: api_instance = operation_request_body_api.OperationRequestBodyApi(api_client) # example passing only required values which don't have defaults set - body = "body_example" + body = StringTypeMatchesStrings("body_example") try: api_response = api_instance.post_string_type_matches_strings_request_body( body=body, @@ -5870,29 +5670,28 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_string_type_matches_strings_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_string_type_matches_strings_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**StringTypeMatchesStrings**](../../models/StringTypeMatchesStrings.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -str, | str, | | ### Return Types, Responses Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_string_type_matches_strings_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_string_type_matches_strings_request_body.response_for_200.ApiResponse) | success -#### post_string_type_matches_strings_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -5907,8 +5706,6 @@ No authorization required # **post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_request_body** -> post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_request_body(the_default_keyword_does_not_do_anything_if_the_property_is_missing) - ### Example @@ -5944,15 +5741,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing**](../../models/TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.md) | | @@ -5963,9 +5760,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_request_body.response_for_200.ApiResponse) | success -#### post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -5980,8 +5777,6 @@ No authorization required # **post_uniqueitems_false_validation_request_body** -> post_uniqueitems_false_validation_request_body(body) - ### Example @@ -6015,15 +5810,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_uniqueitems_false_validation_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_uniqueitems_false_validation_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**UniqueitemsFalseValidation**](../../models/UniqueitemsFalseValidation.md) | | @@ -6034,9 +5829,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_uniqueitems_false_validation_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_uniqueitems_false_validation_request_body.response_for_200.ApiResponse) | success -#### post_uniqueitems_false_validation_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -6051,8 +5846,6 @@ No authorization required # **post_uniqueitems_validation_request_body** -> post_uniqueitems_validation_request_body(body) - ### Example @@ -6086,15 +5879,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_uniqueitems_validation_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_uniqueitems_validation_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**UniqueitemsValidation**](../../models/UniqueitemsValidation.md) | | @@ -6105,9 +5898,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_uniqueitems_validation_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_uniqueitems_validation_request_body.response_for_200.ApiResponse) | success -#### post_uniqueitems_validation_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -6122,8 +5915,6 @@ No authorization required # **post_uri_format_request_body** -> post_uri_format_request_body(body) - ### Example @@ -6131,6 +5922,7 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import operation_request_body_api +from unit_test_api.model.uri_format import UriFormat from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -6144,7 +5936,7 @@ with unit_test_api.ApiClient(configuration) as api_client: api_instance = operation_request_body_api.OperationRequestBodyApi(api_client) # example passing only required values which don't have defaults set - body = None + body = UriFormat(None) try: api_response = api_instance.post_uri_format_request_body( body=body, @@ -6156,29 +5948,28 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_uri_format_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_uri_format_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**UriFormat**](../../models/UriFormat.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, | frozendict.frozendict, str, decimal.Decimal, BoolClass, NoneClass, tuple, bytes, FileIO | | ### Return Types, Responses Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_uri_format_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_uri_format_request_body.response_for_200.ApiResponse) | success -#### post_uri_format_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -6193,8 +5984,6 @@ No authorization required # **post_uri_reference_format_request_body** -> post_uri_reference_format_request_body(body) - ### Example @@ -6202,6 +5991,7 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import operation_request_body_api +from unit_test_api.model.uri_reference_format import UriReferenceFormat from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -6215,7 +6005,7 @@ with unit_test_api.ApiClient(configuration) as api_client: api_instance = operation_request_body_api.OperationRequestBodyApi(api_client) # example passing only required values which don't have defaults set - body = None + body = UriReferenceFormat(None) try: api_response = api_instance.post_uri_reference_format_request_body( body=body, @@ -6227,29 +6017,28 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_uri_reference_format_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_uri_reference_format_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**UriReferenceFormat**](../../models/UriReferenceFormat.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, | frozendict.frozendict, str, decimal.Decimal, BoolClass, NoneClass, tuple, bytes, FileIO | | ### Return Types, Responses Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_uri_reference_format_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_uri_reference_format_request_body.response_for_200.ApiResponse) | success -#### post_uri_reference_format_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -6264,8 +6053,6 @@ No authorization required # **post_uri_template_format_request_body** -> post_uri_template_format_request_body(body) - ### Example @@ -6273,6 +6060,7 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import operation_request_body_api +from unit_test_api.model.uri_template_format import UriTemplateFormat from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -6286,7 +6074,7 @@ with unit_test_api.ApiClient(configuration) as api_client: api_instance = operation_request_body_api.OperationRequestBodyApi(api_client) # example passing only required values which don't have defaults set - body = None + body = UriTemplateFormat(None) try: api_response = api_instance.post_uri_template_format_request_body( body=body, @@ -6298,29 +6086,28 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_uri_template_format_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_uri_template_format_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**UriTemplateFormat**](../../models/UriTemplateFormat.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, | frozendict.frozendict, str, decimal.Decimal, BoolClass, NoneClass, tuple, bytes, FileIO | | ### Return Types, Responses Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_uri_template_format_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_uri_template_format_request_body.response_for_200.ApiResponse) | success -#### post_uri_template_format_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | diff --git a/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/PathPostApi.md b/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/PathPostApi.md index f59e95a4c93..0c86c8d0fb8 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/PathPostApi.md +++ b/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/PathPostApi.md @@ -182,8 +182,6 @@ Method | HTTP request | Description # **post_additionalproperties_allows_a_schema_which_should_validate_request_body** -> post_additionalproperties_allows_a_schema_which_should_validate_request_body(additionalproperties_allows_a_schema_which_should_validate) - ### Example @@ -220,15 +218,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_additionalproperties_allows_a_schema_which_should_validate_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_additionalproperties_allows_a_schema_which_should_validate_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AdditionalpropertiesAllowsASchemaWhichShouldValidate**](../../models/AdditionalpropertiesAllowsASchemaWhichShouldValidate.md) | | @@ -239,9 +237,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_additionalproperties_allows_a_schema_which_should_validate_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_additionalproperties_allows_a_schema_which_should_validate_request_body.response_for_200.ApiResponse) | success -#### post_additionalproperties_allows_a_schema_which_should_validate_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -256,8 +254,6 @@ No authorization required # **post_additionalproperties_allows_a_schema_which_should_validate_response_body_for_content_types** -> AdditionalpropertiesAllowsASchemaWhichShouldValidate post_additionalproperties_allows_a_schema_which_should_validate_response_body_for_content_types() - ### Example @@ -265,7 +261,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import path_post_api -from unit_test_api.model.additionalproperties_allows_a_schema_which_should_validate import AdditionalpropertiesAllowsASchemaWhichShouldValidate from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -293,16 +288,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_additionalproperties_allows_a_schema_which_should_validate_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_additionalproperties_allows_a_schema_which_should_validate_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_additionalproperties_allows_a_schema_which_should_validate_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_additionalproperties_allows_a_schema_which_should_validate_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AdditionalpropertiesAllowsASchemaWhichShouldValidate**](../../models/AdditionalpropertiesAllowsASchemaWhichShouldValidate.md) | | @@ -316,8 +311,6 @@ No authorization required # **post_additionalproperties_are_allowed_by_default_request_body** -> post_additionalproperties_are_allowed_by_default_request_body(additionalproperties_are_allowed_by_default) - ### Example @@ -351,15 +344,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_additionalproperties_are_allowed_by_default_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_additionalproperties_are_allowed_by_default_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AdditionalpropertiesAreAllowedByDefault**](../../models/AdditionalpropertiesAreAllowedByDefault.md) | | @@ -370,9 +363,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_additionalproperties_are_allowed_by_default_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_additionalproperties_are_allowed_by_default_request_body.response_for_200.ApiResponse) | success -#### post_additionalproperties_are_allowed_by_default_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -387,8 +380,6 @@ No authorization required # **post_additionalproperties_are_allowed_by_default_response_body_for_content_types** -> AdditionalpropertiesAreAllowedByDefault post_additionalproperties_are_allowed_by_default_response_body_for_content_types() - ### Example @@ -396,7 +387,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import path_post_api -from unit_test_api.model.additionalproperties_are_allowed_by_default import AdditionalpropertiesAreAllowedByDefault from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -424,16 +414,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_additionalproperties_are_allowed_by_default_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_additionalproperties_are_allowed_by_default_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_additionalproperties_are_allowed_by_default_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_additionalproperties_are_allowed_by_default_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AdditionalpropertiesAreAllowedByDefault**](../../models/AdditionalpropertiesAreAllowedByDefault.md) | | @@ -447,8 +437,6 @@ No authorization required # **post_additionalproperties_can_exist_by_itself_request_body** -> post_additionalproperties_can_exist_by_itself_request_body(additionalproperties_can_exist_by_itself) - ### Example @@ -484,15 +472,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_additionalproperties_can_exist_by_itself_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_additionalproperties_can_exist_by_itself_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AdditionalpropertiesCanExistByItself**](../../models/AdditionalpropertiesCanExistByItself.md) | | @@ -503,9 +491,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_additionalproperties_can_exist_by_itself_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_additionalproperties_can_exist_by_itself_request_body.response_for_200.ApiResponse) | success -#### post_additionalproperties_can_exist_by_itself_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -520,8 +508,6 @@ No authorization required # **post_additionalproperties_can_exist_by_itself_response_body_for_content_types** -> AdditionalpropertiesCanExistByItself post_additionalproperties_can_exist_by_itself_response_body_for_content_types() - ### Example @@ -529,7 +515,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import path_post_api -from unit_test_api.model.additionalproperties_can_exist_by_itself import AdditionalpropertiesCanExistByItself from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -557,16 +542,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_additionalproperties_can_exist_by_itself_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_additionalproperties_can_exist_by_itself_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_additionalproperties_can_exist_by_itself_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_additionalproperties_can_exist_by_itself_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AdditionalpropertiesCanExistByItself**](../../models/AdditionalpropertiesCanExistByItself.md) | | @@ -580,8 +565,6 @@ No authorization required # **post_additionalproperties_should_not_look_in_applicators_request_body** -> post_additionalproperties_should_not_look_in_applicators_request_body(additionalproperties_should_not_look_in_applicators) - ### Example @@ -615,15 +598,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_additionalproperties_should_not_look_in_applicators_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_additionalproperties_should_not_look_in_applicators_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AdditionalpropertiesShouldNotLookInApplicators**](../../models/AdditionalpropertiesShouldNotLookInApplicators.md) | | @@ -634,9 +617,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_additionalproperties_should_not_look_in_applicators_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_additionalproperties_should_not_look_in_applicators_request_body.response_for_200.ApiResponse) | success -#### post_additionalproperties_should_not_look_in_applicators_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -651,8 +634,6 @@ No authorization required # **post_additionalproperties_should_not_look_in_applicators_response_body_for_content_types** -> AdditionalpropertiesShouldNotLookInApplicators post_additionalproperties_should_not_look_in_applicators_response_body_for_content_types() - ### Example @@ -660,7 +641,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import path_post_api -from unit_test_api.model.additionalproperties_should_not_look_in_applicators import AdditionalpropertiesShouldNotLookInApplicators from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -688,16 +668,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_additionalproperties_should_not_look_in_applicators_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_additionalproperties_should_not_look_in_applicators_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_additionalproperties_should_not_look_in_applicators_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_additionalproperties_should_not_look_in_applicators_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AdditionalpropertiesShouldNotLookInApplicators**](../../models/AdditionalpropertiesShouldNotLookInApplicators.md) | | @@ -711,8 +691,6 @@ No authorization required # **post_allof_combined_with_anyof_oneof_request_body** -> post_allof_combined_with_anyof_oneof_request_body(allof_combined_with_anyof_oneof) - ### Example @@ -746,15 +724,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_allof_combined_with_anyof_oneof_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_allof_combined_with_anyof_oneof_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AllofCombinedWithAnyofOneof**](../../models/AllofCombinedWithAnyofOneof.md) | | @@ -765,9 +743,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_allof_combined_with_anyof_oneof_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_allof_combined_with_anyof_oneof_request_body.response_for_200.ApiResponse) | success -#### post_allof_combined_with_anyof_oneof_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -782,8 +760,6 @@ No authorization required # **post_allof_combined_with_anyof_oneof_response_body_for_content_types** -> AllofCombinedWithAnyofOneof post_allof_combined_with_anyof_oneof_response_body_for_content_types() - ### Example @@ -791,7 +767,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import path_post_api -from unit_test_api.model.allof_combined_with_anyof_oneof import AllofCombinedWithAnyofOneof from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -819,16 +794,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_allof_combined_with_anyof_oneof_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_allof_combined_with_anyof_oneof_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_allof_combined_with_anyof_oneof_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_allof_combined_with_anyof_oneof_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AllofCombinedWithAnyofOneof**](../../models/AllofCombinedWithAnyofOneof.md) | | @@ -842,8 +817,6 @@ No authorization required # **post_allof_request_body** -> post_allof_request_body(allof) - ### Example @@ -877,15 +850,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_allof_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_allof_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**Allof**](../../models/Allof.md) | | @@ -896,9 +869,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_allof_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_allof_request_body.response_for_200.ApiResponse) | success -#### post_allof_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -913,8 +886,6 @@ No authorization required # **post_allof_response_body_for_content_types** -> Allof post_allof_response_body_for_content_types() - ### Example @@ -922,7 +893,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import path_post_api -from unit_test_api.model.allof import Allof from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -950,16 +920,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_allof_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_allof_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_allof_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_allof_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**Allof**](../../models/Allof.md) | | @@ -973,8 +943,6 @@ No authorization required # **post_allof_simple_types_request_body** -> post_allof_simple_types_request_body(allof_simple_types) - ### Example @@ -1008,15 +976,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_allof_simple_types_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_allof_simple_types_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AllofSimpleTypes**](../../models/AllofSimpleTypes.md) | | @@ -1027,9 +995,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_allof_simple_types_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_allof_simple_types_request_body.response_for_200.ApiResponse) | success -#### post_allof_simple_types_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -1044,8 +1012,6 @@ No authorization required # **post_allof_simple_types_response_body_for_content_types** -> AllofSimpleTypes post_allof_simple_types_response_body_for_content_types() - ### Example @@ -1053,7 +1019,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import path_post_api -from unit_test_api.model.allof_simple_types import AllofSimpleTypes from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -1081,16 +1046,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_allof_simple_types_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_allof_simple_types_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_allof_simple_types_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_allof_simple_types_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AllofSimpleTypes**](../../models/AllofSimpleTypes.md) | | @@ -1104,8 +1069,6 @@ No authorization required # **post_allof_with_base_schema_request_body** -> post_allof_with_base_schema_request_body(allof_with_base_schema) - ### Example @@ -1139,15 +1102,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_allof_with_base_schema_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_allof_with_base_schema_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AllofWithBaseSchema**](../../models/AllofWithBaseSchema.md) | | @@ -1158,9 +1121,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_allof_with_base_schema_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_allof_with_base_schema_request_body.response_for_200.ApiResponse) | success -#### post_allof_with_base_schema_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -1175,8 +1138,6 @@ No authorization required # **post_allof_with_base_schema_response_body_for_content_types** -> AllofWithBaseSchema post_allof_with_base_schema_response_body_for_content_types() - ### Example @@ -1184,7 +1145,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import path_post_api -from unit_test_api.model.allof_with_base_schema import AllofWithBaseSchema from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -1212,16 +1172,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_allof_with_base_schema_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_allof_with_base_schema_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_allof_with_base_schema_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_allof_with_base_schema_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AllofWithBaseSchema**](../../models/AllofWithBaseSchema.md) | | @@ -1235,8 +1195,6 @@ No authorization required # **post_allof_with_one_empty_schema_request_body** -> post_allof_with_one_empty_schema_request_body(allof_with_one_empty_schema) - ### Example @@ -1270,15 +1228,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_allof_with_one_empty_schema_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_allof_with_one_empty_schema_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AllofWithOneEmptySchema**](../../models/AllofWithOneEmptySchema.md) | | @@ -1289,9 +1247,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_allof_with_one_empty_schema_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_allof_with_one_empty_schema_request_body.response_for_200.ApiResponse) | success -#### post_allof_with_one_empty_schema_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -1306,8 +1264,6 @@ No authorization required # **post_allof_with_one_empty_schema_response_body_for_content_types** -> AllofWithOneEmptySchema post_allof_with_one_empty_schema_response_body_for_content_types() - ### Example @@ -1315,7 +1271,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import path_post_api -from unit_test_api.model.allof_with_one_empty_schema import AllofWithOneEmptySchema from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -1343,16 +1298,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_allof_with_one_empty_schema_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_allof_with_one_empty_schema_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_allof_with_one_empty_schema_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_allof_with_one_empty_schema_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AllofWithOneEmptySchema**](../../models/AllofWithOneEmptySchema.md) | | @@ -1366,8 +1321,6 @@ No authorization required # **post_allof_with_the_first_empty_schema_request_body** -> post_allof_with_the_first_empty_schema_request_body(allof_with_the_first_empty_schema) - ### Example @@ -1401,15 +1354,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_allof_with_the_first_empty_schema_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_allof_with_the_first_empty_schema_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AllofWithTheFirstEmptySchema**](../../models/AllofWithTheFirstEmptySchema.md) | | @@ -1420,9 +1373,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_allof_with_the_first_empty_schema_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_allof_with_the_first_empty_schema_request_body.response_for_200.ApiResponse) | success -#### post_allof_with_the_first_empty_schema_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -1437,8 +1390,6 @@ No authorization required # **post_allof_with_the_first_empty_schema_response_body_for_content_types** -> AllofWithTheFirstEmptySchema post_allof_with_the_first_empty_schema_response_body_for_content_types() - ### Example @@ -1446,7 +1397,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import path_post_api -from unit_test_api.model.allof_with_the_first_empty_schema import AllofWithTheFirstEmptySchema from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -1474,16 +1424,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_allof_with_the_first_empty_schema_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_allof_with_the_first_empty_schema_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_allof_with_the_first_empty_schema_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_allof_with_the_first_empty_schema_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AllofWithTheFirstEmptySchema**](../../models/AllofWithTheFirstEmptySchema.md) | | @@ -1497,8 +1447,6 @@ No authorization required # **post_allof_with_the_last_empty_schema_request_body** -> post_allof_with_the_last_empty_schema_request_body(allof_with_the_last_empty_schema) - ### Example @@ -1532,15 +1480,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_allof_with_the_last_empty_schema_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_allof_with_the_last_empty_schema_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AllofWithTheLastEmptySchema**](../../models/AllofWithTheLastEmptySchema.md) | | @@ -1551,9 +1499,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_allof_with_the_last_empty_schema_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_allof_with_the_last_empty_schema_request_body.response_for_200.ApiResponse) | success -#### post_allof_with_the_last_empty_schema_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -1568,8 +1516,6 @@ No authorization required # **post_allof_with_the_last_empty_schema_response_body_for_content_types** -> AllofWithTheLastEmptySchema post_allof_with_the_last_empty_schema_response_body_for_content_types() - ### Example @@ -1577,7 +1523,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import path_post_api -from unit_test_api.model.allof_with_the_last_empty_schema import AllofWithTheLastEmptySchema from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -1605,16 +1550,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_allof_with_the_last_empty_schema_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_allof_with_the_last_empty_schema_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_allof_with_the_last_empty_schema_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_allof_with_the_last_empty_schema_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AllofWithTheLastEmptySchema**](../../models/AllofWithTheLastEmptySchema.md) | | @@ -1628,8 +1573,6 @@ No authorization required # **post_allof_with_two_empty_schemas_request_body** -> post_allof_with_two_empty_schemas_request_body(allof_with_two_empty_schemas) - ### Example @@ -1663,15 +1606,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_allof_with_two_empty_schemas_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_allof_with_two_empty_schemas_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AllofWithTwoEmptySchemas**](../../models/AllofWithTwoEmptySchemas.md) | | @@ -1682,9 +1625,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_allof_with_two_empty_schemas_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_allof_with_two_empty_schemas_request_body.response_for_200.ApiResponse) | success -#### post_allof_with_two_empty_schemas_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -1699,8 +1642,6 @@ No authorization required # **post_allof_with_two_empty_schemas_response_body_for_content_types** -> AllofWithTwoEmptySchemas post_allof_with_two_empty_schemas_response_body_for_content_types() - ### Example @@ -1708,7 +1649,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import path_post_api -from unit_test_api.model.allof_with_two_empty_schemas import AllofWithTwoEmptySchemas from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -1736,16 +1676,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_allof_with_two_empty_schemas_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_allof_with_two_empty_schemas_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_allof_with_two_empty_schemas_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_allof_with_two_empty_schemas_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AllofWithTwoEmptySchemas**](../../models/AllofWithTwoEmptySchemas.md) | | @@ -1759,8 +1699,6 @@ No authorization required # **post_anyof_complex_types_request_body** -> post_anyof_complex_types_request_body(anyof_complex_types) - ### Example @@ -1794,15 +1732,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_anyof_complex_types_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_anyof_complex_types_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AnyofComplexTypes**](../../models/AnyofComplexTypes.md) | | @@ -1813,9 +1751,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_anyof_complex_types_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_anyof_complex_types_request_body.response_for_200.ApiResponse) | success -#### post_anyof_complex_types_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -1830,8 +1768,6 @@ No authorization required # **post_anyof_complex_types_response_body_for_content_types** -> AnyofComplexTypes post_anyof_complex_types_response_body_for_content_types() - ### Example @@ -1839,7 +1775,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import path_post_api -from unit_test_api.model.anyof_complex_types import AnyofComplexTypes from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -1867,16 +1802,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_anyof_complex_types_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_anyof_complex_types_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_anyof_complex_types_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_anyof_complex_types_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AnyofComplexTypes**](../../models/AnyofComplexTypes.md) | | @@ -1890,8 +1825,6 @@ No authorization required # **post_anyof_request_body** -> post_anyof_request_body(anyof) - ### Example @@ -1925,15 +1858,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_anyof_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_anyof_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**Anyof**](../../models/Anyof.md) | | @@ -1944,9 +1877,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_anyof_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_anyof_request_body.response_for_200.ApiResponse) | success -#### post_anyof_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -1961,8 +1894,6 @@ No authorization required # **post_anyof_response_body_for_content_types** -> Anyof post_anyof_response_body_for_content_types() - ### Example @@ -1970,7 +1901,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import path_post_api -from unit_test_api.model.anyof import Anyof from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -1998,16 +1928,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_anyof_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_anyof_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_anyof_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_anyof_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**Anyof**](../../models/Anyof.md) | | @@ -2021,8 +1951,6 @@ No authorization required # **post_anyof_with_base_schema_request_body** -> post_anyof_with_base_schema_request_body(body) - ### Example @@ -2056,15 +1984,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_anyof_with_base_schema_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_anyof_with_base_schema_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AnyofWithBaseSchema**](../../models/AnyofWithBaseSchema.md) | | @@ -2075,9 +2003,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_anyof_with_base_schema_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_anyof_with_base_schema_request_body.response_for_200.ApiResponse) | success -#### post_anyof_with_base_schema_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -2092,8 +2020,6 @@ No authorization required # **post_anyof_with_base_schema_response_body_for_content_types** -> AnyofWithBaseSchema post_anyof_with_base_schema_response_body_for_content_types() - ### Example @@ -2101,7 +2027,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import path_post_api -from unit_test_api.model.anyof_with_base_schema import AnyofWithBaseSchema from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -2129,16 +2054,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_anyof_with_base_schema_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_anyof_with_base_schema_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_anyof_with_base_schema_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_anyof_with_base_schema_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AnyofWithBaseSchema**](../../models/AnyofWithBaseSchema.md) | | @@ -2152,8 +2077,6 @@ No authorization required # **post_anyof_with_one_empty_schema_request_body** -> post_anyof_with_one_empty_schema_request_body(anyof_with_one_empty_schema) - ### Example @@ -2187,15 +2110,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_anyof_with_one_empty_schema_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_anyof_with_one_empty_schema_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AnyofWithOneEmptySchema**](../../models/AnyofWithOneEmptySchema.md) | | @@ -2206,9 +2129,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_anyof_with_one_empty_schema_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_anyof_with_one_empty_schema_request_body.response_for_200.ApiResponse) | success -#### post_anyof_with_one_empty_schema_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -2223,8 +2146,6 @@ No authorization required # **post_anyof_with_one_empty_schema_response_body_for_content_types** -> AnyofWithOneEmptySchema post_anyof_with_one_empty_schema_response_body_for_content_types() - ### Example @@ -2232,7 +2153,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import path_post_api -from unit_test_api.model.anyof_with_one_empty_schema import AnyofWithOneEmptySchema from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -2260,16 +2180,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_anyof_with_one_empty_schema_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_anyof_with_one_empty_schema_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_anyof_with_one_empty_schema_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_anyof_with_one_empty_schema_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AnyofWithOneEmptySchema**](../../models/AnyofWithOneEmptySchema.md) | | @@ -2283,8 +2203,6 @@ No authorization required # **post_array_type_matches_arrays_request_body** -> post_array_type_matches_arrays_request_body(array_type_matches_arrays) - ### Example @@ -2320,15 +2238,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_array_type_matches_arrays_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_array_type_matches_arrays_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**ArrayTypeMatchesArrays**](../../models/ArrayTypeMatchesArrays.md) | | @@ -2339,9 +2257,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_array_type_matches_arrays_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_array_type_matches_arrays_request_body.response_for_200.ApiResponse) | success -#### post_array_type_matches_arrays_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -2356,8 +2274,6 @@ No authorization required # **post_array_type_matches_arrays_response_body_for_content_types** -> ArrayTypeMatchesArrays post_array_type_matches_arrays_response_body_for_content_types() - ### Example @@ -2365,7 +2281,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import path_post_api -from unit_test_api.model.array_type_matches_arrays import ArrayTypeMatchesArrays from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -2393,16 +2308,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_array_type_matches_arrays_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_array_type_matches_arrays_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_array_type_matches_arrays_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_array_type_matches_arrays_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**ArrayTypeMatchesArrays**](../../models/ArrayTypeMatchesArrays.md) | | @@ -2416,8 +2331,6 @@ No authorization required # **post_boolean_type_matches_booleans_request_body** -> post_boolean_type_matches_booleans_request_body(body) - ### Example @@ -2425,6 +2338,7 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import path_post_api +from unit_test_api.model.boolean_type_matches_booleans import BooleanTypeMatchesBooleans from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -2438,7 +2352,7 @@ with unit_test_api.ApiClient(configuration) as api_client: api_instance = path_post_api.PathPostApi(api_client) # example passing only required values which don't have defaults set - body = True + body = BooleanTypeMatchesBooleans(True) try: api_response = api_instance.post_boolean_type_matches_booleans_request_body( body=body, @@ -2450,29 +2364,28 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_boolean_type_matches_booleans_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_boolean_type_matches_booleans_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**BooleanTypeMatchesBooleans**](../../models/BooleanTypeMatchesBooleans.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -bool, | BoolClass, | | ### Return Types, Responses Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_boolean_type_matches_booleans_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_boolean_type_matches_booleans_request_body.response_for_200.ApiResponse) | success -#### post_boolean_type_matches_booleans_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -2487,8 +2400,6 @@ No authorization required # **post_boolean_type_matches_booleans_response_body_for_content_types** -> bool post_boolean_type_matches_booleans_response_body_for_content_types() - ### Example @@ -2523,21 +2434,20 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_boolean_type_matches_booleans_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_boolean_type_matches_booleans_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_boolean_type_matches_booleans_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_boolean_type_matches_booleans_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**BooleanTypeMatchesBooleans**](../../models/BooleanTypeMatchesBooleans.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -bool, | BoolClass, | | ### Authorization @@ -2547,8 +2457,6 @@ No authorization required # **post_by_int_request_body** -> post_by_int_request_body(body) - ### Example @@ -2582,15 +2490,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_by_int_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_by_int_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**ByInt**](../../models/ByInt.md) | | @@ -2601,9 +2509,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_by_int_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_by_int_request_body.response_for_200.ApiResponse) | success -#### post_by_int_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -2618,8 +2526,6 @@ No authorization required # **post_by_int_response_body_for_content_types** -> ByInt post_by_int_response_body_for_content_types() - ### Example @@ -2627,7 +2533,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import path_post_api -from unit_test_api.model.by_int import ByInt from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -2655,16 +2560,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_by_int_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_by_int_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_by_int_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_by_int_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**ByInt**](../../models/ByInt.md) | | @@ -2678,8 +2583,6 @@ No authorization required # **post_by_number_request_body** -> post_by_number_request_body(body) - ### Example @@ -2713,15 +2616,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_by_number_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_by_number_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**ByNumber**](../../models/ByNumber.md) | | @@ -2732,9 +2635,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_by_number_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_by_number_request_body.response_for_200.ApiResponse) | success -#### post_by_number_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -2749,8 +2652,6 @@ No authorization required # **post_by_number_response_body_for_content_types** -> ByNumber post_by_number_response_body_for_content_types() - ### Example @@ -2758,7 +2659,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import path_post_api -from unit_test_api.model.by_number import ByNumber from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -2786,16 +2686,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_by_number_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_by_number_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_by_number_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_by_number_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**ByNumber**](../../models/ByNumber.md) | | @@ -2809,8 +2709,6 @@ No authorization required # **post_by_small_number_request_body** -> post_by_small_number_request_body(body) - ### Example @@ -2844,15 +2742,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_by_small_number_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_by_small_number_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**BySmallNumber**](../../models/BySmallNumber.md) | | @@ -2863,9 +2761,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_by_small_number_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_by_small_number_request_body.response_for_200.ApiResponse) | success -#### post_by_small_number_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -2880,8 +2778,6 @@ No authorization required # **post_by_small_number_response_body_for_content_types** -> BySmallNumber post_by_small_number_response_body_for_content_types() - ### Example @@ -2889,7 +2785,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import path_post_api -from unit_test_api.model.by_small_number import BySmallNumber from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -2917,16 +2812,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_by_small_number_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_by_small_number_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_by_small_number_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_by_small_number_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**BySmallNumber**](../../models/BySmallNumber.md) | | @@ -2940,8 +2835,6 @@ No authorization required # **post_date_time_format_request_body** -> post_date_time_format_request_body(body) - ### Example @@ -2949,6 +2842,7 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import path_post_api +from unit_test_api.model.date_time_format import DateTimeFormat from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -2962,7 +2856,7 @@ with unit_test_api.ApiClient(configuration) as api_client: api_instance = path_post_api.PathPostApi(api_client) # example passing only required values which don't have defaults set - body = None + body = DateTimeFormat(None) try: api_response = api_instance.post_date_time_format_request_body( body=body, @@ -2974,29 +2868,28 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_date_time_format_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_date_time_format_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**DateTimeFormat**](../../models/DateTimeFormat.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, | frozendict.frozendict, str, decimal.Decimal, BoolClass, NoneClass, tuple, bytes, FileIO | | value must conform to RFC-3339 date-time ### Return Types, Responses Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_date_time_format_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_date_time_format_request_body.response_for_200.ApiResponse) | success -#### post_date_time_format_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -3011,8 +2904,6 @@ No authorization required # **post_date_time_format_response_body_for_content_types** -> bool, date, datetime, dict, float, int, list, str, none_type post_date_time_format_response_body_for_content_types() - ### Example @@ -3047,21 +2938,20 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_date_time_format_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_date_time_format_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_date_time_format_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_date_time_format_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**DateTimeFormat**](../../models/DateTimeFormat.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, | frozendict.frozendict, str, decimal.Decimal, BoolClass, NoneClass, tuple, bytes, FileIO | | value must conform to RFC-3339 date-time ### Authorization @@ -3071,8 +2961,6 @@ No authorization required # **post_email_format_request_body** -> post_email_format_request_body(body) - ### Example @@ -3080,6 +2968,7 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import path_post_api +from unit_test_api.model.email_format import EmailFormat from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -3093,7 +2982,7 @@ with unit_test_api.ApiClient(configuration) as api_client: api_instance = path_post_api.PathPostApi(api_client) # example passing only required values which don't have defaults set - body = None + body = EmailFormat(None) try: api_response = api_instance.post_email_format_request_body( body=body, @@ -3105,29 +2994,28 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_email_format_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_email_format_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**EmailFormat**](../../models/EmailFormat.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, | frozendict.frozendict, str, decimal.Decimal, BoolClass, NoneClass, tuple, bytes, FileIO | | ### Return Types, Responses Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_email_format_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_email_format_request_body.response_for_200.ApiResponse) | success -#### post_email_format_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -3142,8 +3030,6 @@ No authorization required # **post_email_format_response_body_for_content_types** -> bool, date, datetime, dict, float, int, list, str, none_type post_email_format_response_body_for_content_types() - ### Example @@ -3178,21 +3064,20 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_email_format_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_email_format_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_email_format_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_email_format_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**EmailFormat**](../../models/EmailFormat.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, | frozendict.frozendict, str, decimal.Decimal, BoolClass, NoneClass, tuple, bytes, FileIO | | ### Authorization @@ -3202,8 +3087,6 @@ No authorization required # **post_enum_with0_does_not_match_false_request_body** -> post_enum_with0_does_not_match_false_request_body(body) - ### Example @@ -3237,15 +3120,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_enum_with0_does_not_match_false_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_enum_with0_does_not_match_false_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**EnumWith0DoesNotMatchFalse**](../../models/EnumWith0DoesNotMatchFalse.md) | | @@ -3256,9 +3139,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_enum_with0_does_not_match_false_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_enum_with0_does_not_match_false_request_body.response_for_200.ApiResponse) | success -#### post_enum_with0_does_not_match_false_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -3273,8 +3156,6 @@ No authorization required # **post_enum_with0_does_not_match_false_response_body_for_content_types** -> EnumWith0DoesNotMatchFalse post_enum_with0_does_not_match_false_response_body_for_content_types() - ### Example @@ -3282,7 +3163,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import path_post_api -from unit_test_api.model.enum_with0_does_not_match_false import EnumWith0DoesNotMatchFalse from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -3310,16 +3190,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_enum_with0_does_not_match_false_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_enum_with0_does_not_match_false_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_enum_with0_does_not_match_false_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_enum_with0_does_not_match_false_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**EnumWith0DoesNotMatchFalse**](../../models/EnumWith0DoesNotMatchFalse.md) | | @@ -3333,8 +3213,6 @@ No authorization required # **post_enum_with1_does_not_match_true_request_body** -> post_enum_with1_does_not_match_true_request_body(body) - ### Example @@ -3368,15 +3246,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_enum_with1_does_not_match_true_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_enum_with1_does_not_match_true_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**EnumWith1DoesNotMatchTrue**](../../models/EnumWith1DoesNotMatchTrue.md) | | @@ -3387,9 +3265,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_enum_with1_does_not_match_true_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_enum_with1_does_not_match_true_request_body.response_for_200.ApiResponse) | success -#### post_enum_with1_does_not_match_true_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -3404,8 +3282,6 @@ No authorization required # **post_enum_with1_does_not_match_true_response_body_for_content_types** -> EnumWith1DoesNotMatchTrue post_enum_with1_does_not_match_true_response_body_for_content_types() - ### Example @@ -3413,7 +3289,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import path_post_api -from unit_test_api.model.enum_with1_does_not_match_true import EnumWith1DoesNotMatchTrue from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -3441,16 +3316,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_enum_with1_does_not_match_true_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_enum_with1_does_not_match_true_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_enum_with1_does_not_match_true_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_enum_with1_does_not_match_true_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**EnumWith1DoesNotMatchTrue**](../../models/EnumWith1DoesNotMatchTrue.md) | | @@ -3464,8 +3339,6 @@ No authorization required # **post_enum_with_escaped_characters_request_body** -> post_enum_with_escaped_characters_request_body(body) - ### Example @@ -3499,15 +3372,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_enum_with_escaped_characters_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_enum_with_escaped_characters_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**EnumWithEscapedCharacters**](../../models/EnumWithEscapedCharacters.md) | | @@ -3518,9 +3391,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_enum_with_escaped_characters_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_enum_with_escaped_characters_request_body.response_for_200.ApiResponse) | success -#### post_enum_with_escaped_characters_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -3535,8 +3408,6 @@ No authorization required # **post_enum_with_escaped_characters_response_body_for_content_types** -> EnumWithEscapedCharacters post_enum_with_escaped_characters_response_body_for_content_types() - ### Example @@ -3544,7 +3415,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import path_post_api -from unit_test_api.model.enum_with_escaped_characters import EnumWithEscapedCharacters from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -3572,16 +3442,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_enum_with_escaped_characters_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_enum_with_escaped_characters_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_enum_with_escaped_characters_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_enum_with_escaped_characters_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**EnumWithEscapedCharacters**](../../models/EnumWithEscapedCharacters.md) | | @@ -3595,8 +3465,6 @@ No authorization required # **post_enum_with_false_does_not_match0_request_body** -> post_enum_with_false_does_not_match0_request_body(body) - ### Example @@ -3630,15 +3498,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_enum_with_false_does_not_match0_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_enum_with_false_does_not_match0_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**EnumWithFalseDoesNotMatch0**](../../models/EnumWithFalseDoesNotMatch0.md) | | @@ -3649,9 +3517,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_enum_with_false_does_not_match0_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_enum_with_false_does_not_match0_request_body.response_for_200.ApiResponse) | success -#### post_enum_with_false_does_not_match0_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -3666,8 +3534,6 @@ No authorization required # **post_enum_with_false_does_not_match0_response_body_for_content_types** -> EnumWithFalseDoesNotMatch0 post_enum_with_false_does_not_match0_response_body_for_content_types() - ### Example @@ -3675,7 +3541,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import path_post_api -from unit_test_api.model.enum_with_false_does_not_match0 import EnumWithFalseDoesNotMatch0 from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -3703,16 +3568,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_enum_with_false_does_not_match0_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_enum_with_false_does_not_match0_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_enum_with_false_does_not_match0_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_enum_with_false_does_not_match0_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**EnumWithFalseDoesNotMatch0**](../../models/EnumWithFalseDoesNotMatch0.md) | | @@ -3726,8 +3591,6 @@ No authorization required # **post_enum_with_true_does_not_match1_request_body** -> post_enum_with_true_does_not_match1_request_body(body) - ### Example @@ -3761,15 +3624,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_enum_with_true_does_not_match1_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_enum_with_true_does_not_match1_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**EnumWithTrueDoesNotMatch1**](../../models/EnumWithTrueDoesNotMatch1.md) | | @@ -3780,9 +3643,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_enum_with_true_does_not_match1_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_enum_with_true_does_not_match1_request_body.response_for_200.ApiResponse) | success -#### post_enum_with_true_does_not_match1_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -3797,8 +3660,6 @@ No authorization required # **post_enum_with_true_does_not_match1_response_body_for_content_types** -> EnumWithTrueDoesNotMatch1 post_enum_with_true_does_not_match1_response_body_for_content_types() - ### Example @@ -3806,7 +3667,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import path_post_api -from unit_test_api.model.enum_with_true_does_not_match1 import EnumWithTrueDoesNotMatch1 from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -3834,16 +3694,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_enum_with_true_does_not_match1_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_enum_with_true_does_not_match1_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_enum_with_true_does_not_match1_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_enum_with_true_does_not_match1_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**EnumWithTrueDoesNotMatch1**](../../models/EnumWithTrueDoesNotMatch1.md) | | @@ -3857,8 +3717,6 @@ No authorization required # **post_enums_in_properties_request_body** -> post_enums_in_properties_request_body(enums_in_properties) - ### Example @@ -3895,15 +3753,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_enums_in_properties_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_enums_in_properties_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**EnumsInProperties**](../../models/EnumsInProperties.md) | | @@ -3914,9 +3772,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_enums_in_properties_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_enums_in_properties_request_body.response_for_200.ApiResponse) | success -#### post_enums_in_properties_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -3931,8 +3789,6 @@ No authorization required # **post_enums_in_properties_response_body_for_content_types** -> EnumsInProperties post_enums_in_properties_response_body_for_content_types() - ### Example @@ -3940,7 +3796,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import path_post_api -from unit_test_api.model.enums_in_properties import EnumsInProperties from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -3968,16 +3823,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_enums_in_properties_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_enums_in_properties_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_enums_in_properties_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_enums_in_properties_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**EnumsInProperties**](../../models/EnumsInProperties.md) | | @@ -3991,8 +3846,6 @@ No authorization required # **post_forbidden_property_request_body** -> post_forbidden_property_request_body(forbidden_property) - ### Example @@ -4026,15 +3879,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_forbidden_property_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_forbidden_property_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**ForbiddenProperty**](../../models/ForbiddenProperty.md) | | @@ -4045,9 +3898,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_forbidden_property_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_forbidden_property_request_body.response_for_200.ApiResponse) | success -#### post_forbidden_property_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -4062,8 +3915,6 @@ No authorization required # **post_forbidden_property_response_body_for_content_types** -> ForbiddenProperty post_forbidden_property_response_body_for_content_types() - ### Example @@ -4071,7 +3922,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import path_post_api -from unit_test_api.model.forbidden_property import ForbiddenProperty from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -4099,16 +3949,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_forbidden_property_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_forbidden_property_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_forbidden_property_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_forbidden_property_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**ForbiddenProperty**](../../models/ForbiddenProperty.md) | | @@ -4122,8 +3972,6 @@ No authorization required # **post_hostname_format_request_body** -> post_hostname_format_request_body(body) - ### Example @@ -4131,6 +3979,7 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import path_post_api +from unit_test_api.model.hostname_format import HostnameFormat from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -4144,7 +3993,7 @@ with unit_test_api.ApiClient(configuration) as api_client: api_instance = path_post_api.PathPostApi(api_client) # example passing only required values which don't have defaults set - body = None + body = HostnameFormat(None) try: api_response = api_instance.post_hostname_format_request_body( body=body, @@ -4156,29 +4005,28 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_hostname_format_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_hostname_format_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**HostnameFormat**](../../models/HostnameFormat.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, | frozendict.frozendict, str, decimal.Decimal, BoolClass, NoneClass, tuple, bytes, FileIO | | ### Return Types, Responses Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_hostname_format_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_hostname_format_request_body.response_for_200.ApiResponse) | success -#### post_hostname_format_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -4193,8 +4041,6 @@ No authorization required # **post_hostname_format_response_body_for_content_types** -> bool, date, datetime, dict, float, int, list, str, none_type post_hostname_format_response_body_for_content_types() - ### Example @@ -4229,21 +4075,20 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_hostname_format_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_hostname_format_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_hostname_format_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_hostname_format_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**HostnameFormat**](../../models/HostnameFormat.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, | frozendict.frozendict, str, decimal.Decimal, BoolClass, NoneClass, tuple, bytes, FileIO | | ### Authorization @@ -4253,8 +4098,6 @@ No authorization required # **post_integer_type_matches_integers_request_body** -> post_integer_type_matches_integers_request_body(body) - ### Example @@ -4262,6 +4105,7 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import path_post_api +from unit_test_api.model.integer_type_matches_integers import IntegerTypeMatchesIntegers from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -4275,7 +4119,7 @@ with unit_test_api.ApiClient(configuration) as api_client: api_instance = path_post_api.PathPostApi(api_client) # example passing only required values which don't have defaults set - body = 1 + body = IntegerTypeMatchesIntegers(1) try: api_response = api_instance.post_integer_type_matches_integers_request_body( body=body, @@ -4287,29 +4131,28 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_integer_type_matches_integers_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_integer_type_matches_integers_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**IntegerTypeMatchesIntegers**](../../models/IntegerTypeMatchesIntegers.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -decimal.Decimal, int, | decimal.Decimal, | | ### Return Types, Responses Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_integer_type_matches_integers_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_integer_type_matches_integers_request_body.response_for_200.ApiResponse) | success -#### post_integer_type_matches_integers_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -4324,8 +4167,6 @@ No authorization required # **post_integer_type_matches_integers_response_body_for_content_types** -> int post_integer_type_matches_integers_response_body_for_content_types() - ### Example @@ -4360,21 +4201,20 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_integer_type_matches_integers_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_integer_type_matches_integers_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_integer_type_matches_integers_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_integer_type_matches_integers_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**IntegerTypeMatchesIntegers**](../../models/IntegerTypeMatchesIntegers.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -decimal.Decimal, int, | decimal.Decimal, | | ### Authorization @@ -4384,8 +4224,6 @@ No authorization required # **post_invalid_instance_should_not_raise_error_when_float_division_inf_request_body** -> post_invalid_instance_should_not_raise_error_when_float_division_inf_request_body(body) - ### Example @@ -4419,15 +4257,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_invalid_instance_should_not_raise_error_when_float_division_inf_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_invalid_instance_should_not_raise_error_when_float_division_inf_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf**](../../models/InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf.md) | | @@ -4438,9 +4276,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_invalid_instance_should_not_raise_error_when_float_division_inf_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_invalid_instance_should_not_raise_error_when_float_division_inf_request_body.response_for_200.ApiResponse) | success -#### post_invalid_instance_should_not_raise_error_when_float_division_inf_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -4455,8 +4293,6 @@ No authorization required # **post_invalid_instance_should_not_raise_error_when_float_division_inf_response_body_for_content_types** -> InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf post_invalid_instance_should_not_raise_error_when_float_division_inf_response_body_for_content_types() - ### Example @@ -4464,7 +4300,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import path_post_api -from unit_test_api.model.invalid_instance_should_not_raise_error_when_float_division_inf import InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -4492,16 +4327,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_invalid_instance_should_not_raise_error_when_float_division_inf_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_invalid_instance_should_not_raise_error_when_float_division_inf_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_invalid_instance_should_not_raise_error_when_float_division_inf_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_invalid_instance_should_not_raise_error_when_float_division_inf_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf**](../../models/InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf.md) | | @@ -4515,8 +4350,6 @@ No authorization required # **post_invalid_string_value_for_default_request_body** -> post_invalid_string_value_for_default_request_body(invalid_string_value_for_default) - ### Example @@ -4550,15 +4383,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_invalid_string_value_for_default_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_invalid_string_value_for_default_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**InvalidStringValueForDefault**](../../models/InvalidStringValueForDefault.md) | | @@ -4569,9 +4402,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_invalid_string_value_for_default_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_invalid_string_value_for_default_request_body.response_for_200.ApiResponse) | success -#### post_invalid_string_value_for_default_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -4586,8 +4419,6 @@ No authorization required # **post_invalid_string_value_for_default_response_body_for_content_types** -> InvalidStringValueForDefault post_invalid_string_value_for_default_response_body_for_content_types() - ### Example @@ -4595,7 +4426,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import path_post_api -from unit_test_api.model.invalid_string_value_for_default import InvalidStringValueForDefault from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -4623,16 +4453,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_invalid_string_value_for_default_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_invalid_string_value_for_default_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_invalid_string_value_for_default_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_invalid_string_value_for_default_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**InvalidStringValueForDefault**](../../models/InvalidStringValueForDefault.md) | | @@ -4646,8 +4476,6 @@ No authorization required # **post_ipv4_format_request_body** -> post_ipv4_format_request_body(body) - ### Example @@ -4655,6 +4483,7 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import path_post_api +from unit_test_api.model.ipv4_format import Ipv4Format from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -4668,7 +4497,7 @@ with unit_test_api.ApiClient(configuration) as api_client: api_instance = path_post_api.PathPostApi(api_client) # example passing only required values which don't have defaults set - body = None + body = Ipv4Format(None) try: api_response = api_instance.post_ipv4_format_request_body( body=body, @@ -4680,29 +4509,28 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_ipv4_format_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_ipv4_format_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**Ipv4Format**](../../models/Ipv4Format.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, | frozendict.frozendict, str, decimal.Decimal, BoolClass, NoneClass, tuple, bytes, FileIO | | ### Return Types, Responses Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_ipv4_format_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_ipv4_format_request_body.response_for_200.ApiResponse) | success -#### post_ipv4_format_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -4717,8 +4545,6 @@ No authorization required # **post_ipv4_format_response_body_for_content_types** -> bool, date, datetime, dict, float, int, list, str, none_type post_ipv4_format_response_body_for_content_types() - ### Example @@ -4753,21 +4579,20 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_ipv4_format_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_ipv4_format_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_ipv4_format_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_ipv4_format_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**Ipv4Format**](../../models/Ipv4Format.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, | frozendict.frozendict, str, decimal.Decimal, BoolClass, NoneClass, tuple, bytes, FileIO | | ### Authorization @@ -4777,8 +4602,6 @@ No authorization required # **post_ipv6_format_request_body** -> post_ipv6_format_request_body(body) - ### Example @@ -4786,6 +4609,7 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import path_post_api +from unit_test_api.model.ipv6_format import Ipv6Format from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -4799,7 +4623,7 @@ with unit_test_api.ApiClient(configuration) as api_client: api_instance = path_post_api.PathPostApi(api_client) # example passing only required values which don't have defaults set - body = None + body = Ipv6Format(None) try: api_response = api_instance.post_ipv6_format_request_body( body=body, @@ -4811,29 +4635,28 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_ipv6_format_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_ipv6_format_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**Ipv6Format**](../../models/Ipv6Format.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, | frozendict.frozendict, str, decimal.Decimal, BoolClass, NoneClass, tuple, bytes, FileIO | | ### Return Types, Responses Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_ipv6_format_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_ipv6_format_request_body.response_for_200.ApiResponse) | success -#### post_ipv6_format_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -4848,8 +4671,6 @@ No authorization required # **post_ipv6_format_response_body_for_content_types** -> bool, date, datetime, dict, float, int, list, str, none_type post_ipv6_format_response_body_for_content_types() - ### Example @@ -4884,21 +4705,20 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_ipv6_format_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_ipv6_format_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_ipv6_format_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_ipv6_format_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**Ipv6Format**](../../models/Ipv6Format.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, | frozendict.frozendict, str, decimal.Decimal, BoolClass, NoneClass, tuple, bytes, FileIO | | ### Authorization @@ -4908,8 +4728,6 @@ No authorization required # **post_json_pointer_format_request_body** -> post_json_pointer_format_request_body(body) - ### Example @@ -4917,6 +4735,7 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import path_post_api +from unit_test_api.model.json_pointer_format import JsonPointerFormat from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -4930,7 +4749,7 @@ with unit_test_api.ApiClient(configuration) as api_client: api_instance = path_post_api.PathPostApi(api_client) # example passing only required values which don't have defaults set - body = None + body = JsonPointerFormat(None) try: api_response = api_instance.post_json_pointer_format_request_body( body=body, @@ -4942,29 +4761,28 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_json_pointer_format_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_json_pointer_format_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**JsonPointerFormat**](../../models/JsonPointerFormat.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, | frozendict.frozendict, str, decimal.Decimal, BoolClass, NoneClass, tuple, bytes, FileIO | | ### Return Types, Responses Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_json_pointer_format_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_json_pointer_format_request_body.response_for_200.ApiResponse) | success -#### post_json_pointer_format_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -4979,8 +4797,6 @@ No authorization required # **post_json_pointer_format_response_body_for_content_types** -> bool, date, datetime, dict, float, int, list, str, none_type post_json_pointer_format_response_body_for_content_types() - ### Example @@ -5015,21 +4831,20 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_json_pointer_format_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_json_pointer_format_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_json_pointer_format_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_json_pointer_format_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**JsonPointerFormat**](../../models/JsonPointerFormat.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, | frozendict.frozendict, str, decimal.Decimal, BoolClass, NoneClass, tuple, bytes, FileIO | | ### Authorization @@ -5039,8 +4854,6 @@ No authorization required # **post_maximum_validation_request_body** -> post_maximum_validation_request_body(body) - ### Example @@ -5074,15 +4887,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_maximum_validation_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_maximum_validation_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**MaximumValidation**](../../models/MaximumValidation.md) | | @@ -5093,9 +4906,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_maximum_validation_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_maximum_validation_request_body.response_for_200.ApiResponse) | success -#### post_maximum_validation_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -5110,8 +4923,6 @@ No authorization required # **post_maximum_validation_response_body_for_content_types** -> MaximumValidation post_maximum_validation_response_body_for_content_types() - ### Example @@ -5119,7 +4930,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import path_post_api -from unit_test_api.model.maximum_validation import MaximumValidation from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -5147,16 +4957,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_maximum_validation_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_maximum_validation_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_maximum_validation_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_maximum_validation_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**MaximumValidation**](../../models/MaximumValidation.md) | | @@ -5170,8 +4980,6 @@ No authorization required # **post_maximum_validation_with_unsigned_integer_request_body** -> post_maximum_validation_with_unsigned_integer_request_body(body) - ### Example @@ -5205,15 +5013,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_maximum_validation_with_unsigned_integer_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_maximum_validation_with_unsigned_integer_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**MaximumValidationWithUnsignedInteger**](../../models/MaximumValidationWithUnsignedInteger.md) | | @@ -5224,9 +5032,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_maximum_validation_with_unsigned_integer_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_maximum_validation_with_unsigned_integer_request_body.response_for_200.ApiResponse) | success -#### post_maximum_validation_with_unsigned_integer_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -5241,8 +5049,6 @@ No authorization required # **post_maximum_validation_with_unsigned_integer_response_body_for_content_types** -> MaximumValidationWithUnsignedInteger post_maximum_validation_with_unsigned_integer_response_body_for_content_types() - ### Example @@ -5250,7 +5056,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import path_post_api -from unit_test_api.model.maximum_validation_with_unsigned_integer import MaximumValidationWithUnsignedInteger from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -5278,16 +5083,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_maximum_validation_with_unsigned_integer_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_maximum_validation_with_unsigned_integer_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_maximum_validation_with_unsigned_integer_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_maximum_validation_with_unsigned_integer_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**MaximumValidationWithUnsignedInteger**](../../models/MaximumValidationWithUnsignedInteger.md) | | @@ -5301,8 +5106,6 @@ No authorization required # **post_maxitems_validation_request_body** -> post_maxitems_validation_request_body(body) - ### Example @@ -5336,15 +5139,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_maxitems_validation_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_maxitems_validation_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**MaxitemsValidation**](../../models/MaxitemsValidation.md) | | @@ -5355,9 +5158,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_maxitems_validation_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_maxitems_validation_request_body.response_for_200.ApiResponse) | success -#### post_maxitems_validation_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -5372,8 +5175,6 @@ No authorization required # **post_maxitems_validation_response_body_for_content_types** -> MaxitemsValidation post_maxitems_validation_response_body_for_content_types() - ### Example @@ -5381,7 +5182,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import path_post_api -from unit_test_api.model.maxitems_validation import MaxitemsValidation from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -5409,16 +5209,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_maxitems_validation_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_maxitems_validation_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_maxitems_validation_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_maxitems_validation_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**MaxitemsValidation**](../../models/MaxitemsValidation.md) | | @@ -5432,8 +5232,6 @@ No authorization required # **post_maxlength_validation_request_body** -> post_maxlength_validation_request_body(body) - ### Example @@ -5467,15 +5265,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_maxlength_validation_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_maxlength_validation_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**MaxlengthValidation**](../../models/MaxlengthValidation.md) | | @@ -5486,9 +5284,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_maxlength_validation_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_maxlength_validation_request_body.response_for_200.ApiResponse) | success -#### post_maxlength_validation_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -5503,8 +5301,6 @@ No authorization required # **post_maxlength_validation_response_body_for_content_types** -> MaxlengthValidation post_maxlength_validation_response_body_for_content_types() - ### Example @@ -5512,7 +5308,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import path_post_api -from unit_test_api.model.maxlength_validation import MaxlengthValidation from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -5540,16 +5335,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_maxlength_validation_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_maxlength_validation_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_maxlength_validation_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_maxlength_validation_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**MaxlengthValidation**](../../models/MaxlengthValidation.md) | | @@ -5563,8 +5358,6 @@ No authorization required # **post_maxproperties0_means_the_object_is_empty_request_body** -> post_maxproperties0_means_the_object_is_empty_request_body(body) - ### Example @@ -5598,15 +5391,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_maxproperties0_means_the_object_is_empty_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_maxproperties0_means_the_object_is_empty_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**Maxproperties0MeansTheObjectIsEmpty**](../../models/Maxproperties0MeansTheObjectIsEmpty.md) | | @@ -5617,9 +5410,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_maxproperties0_means_the_object_is_empty_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_maxproperties0_means_the_object_is_empty_request_body.response_for_200.ApiResponse) | success -#### post_maxproperties0_means_the_object_is_empty_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -5634,8 +5427,6 @@ No authorization required # **post_maxproperties0_means_the_object_is_empty_response_body_for_content_types** -> Maxproperties0MeansTheObjectIsEmpty post_maxproperties0_means_the_object_is_empty_response_body_for_content_types() - ### Example @@ -5643,7 +5434,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import path_post_api -from unit_test_api.model.maxproperties0_means_the_object_is_empty import Maxproperties0MeansTheObjectIsEmpty from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -5671,16 +5461,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_maxproperties0_means_the_object_is_empty_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_maxproperties0_means_the_object_is_empty_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_maxproperties0_means_the_object_is_empty_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_maxproperties0_means_the_object_is_empty_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**Maxproperties0MeansTheObjectIsEmpty**](../../models/Maxproperties0MeansTheObjectIsEmpty.md) | | @@ -5694,8 +5484,6 @@ No authorization required # **post_maxproperties_validation_request_body** -> post_maxproperties_validation_request_body(body) - ### Example @@ -5729,15 +5517,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_maxproperties_validation_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_maxproperties_validation_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**MaxpropertiesValidation**](../../models/MaxpropertiesValidation.md) | | @@ -5748,9 +5536,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_maxproperties_validation_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_maxproperties_validation_request_body.response_for_200.ApiResponse) | success -#### post_maxproperties_validation_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -5765,8 +5553,6 @@ No authorization required # **post_maxproperties_validation_response_body_for_content_types** -> MaxpropertiesValidation post_maxproperties_validation_response_body_for_content_types() - ### Example @@ -5774,7 +5560,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import path_post_api -from unit_test_api.model.maxproperties_validation import MaxpropertiesValidation from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -5802,16 +5587,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_maxproperties_validation_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_maxproperties_validation_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_maxproperties_validation_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_maxproperties_validation_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**MaxpropertiesValidation**](../../models/MaxpropertiesValidation.md) | | @@ -5825,8 +5610,6 @@ No authorization required # **post_minimum_validation_request_body** -> post_minimum_validation_request_body(body) - ### Example @@ -5860,15 +5643,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_minimum_validation_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_minimum_validation_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**MinimumValidation**](../../models/MinimumValidation.md) | | @@ -5879,9 +5662,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_minimum_validation_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_minimum_validation_request_body.response_for_200.ApiResponse) | success -#### post_minimum_validation_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -5896,8 +5679,6 @@ No authorization required # **post_minimum_validation_response_body_for_content_types** -> MinimumValidation post_minimum_validation_response_body_for_content_types() - ### Example @@ -5905,7 +5686,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import path_post_api -from unit_test_api.model.minimum_validation import MinimumValidation from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -5933,16 +5713,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_minimum_validation_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_minimum_validation_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_minimum_validation_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_minimum_validation_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**MinimumValidation**](../../models/MinimumValidation.md) | | @@ -5956,8 +5736,6 @@ No authorization required # **post_minimum_validation_with_signed_integer_request_body** -> post_minimum_validation_with_signed_integer_request_body(body) - ### Example @@ -5991,15 +5769,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_minimum_validation_with_signed_integer_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_minimum_validation_with_signed_integer_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**MinimumValidationWithSignedInteger**](../../models/MinimumValidationWithSignedInteger.md) | | @@ -6010,9 +5788,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_minimum_validation_with_signed_integer_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_minimum_validation_with_signed_integer_request_body.response_for_200.ApiResponse) | success -#### post_minimum_validation_with_signed_integer_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -6027,8 +5805,6 @@ No authorization required # **post_minimum_validation_with_signed_integer_response_body_for_content_types** -> MinimumValidationWithSignedInteger post_minimum_validation_with_signed_integer_response_body_for_content_types() - ### Example @@ -6036,7 +5812,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import path_post_api -from unit_test_api.model.minimum_validation_with_signed_integer import MinimumValidationWithSignedInteger from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -6064,16 +5839,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_minimum_validation_with_signed_integer_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_minimum_validation_with_signed_integer_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_minimum_validation_with_signed_integer_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_minimum_validation_with_signed_integer_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**MinimumValidationWithSignedInteger**](../../models/MinimumValidationWithSignedInteger.md) | | @@ -6087,8 +5862,6 @@ No authorization required # **post_minitems_validation_request_body** -> post_minitems_validation_request_body(body) - ### Example @@ -6122,15 +5895,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_minitems_validation_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_minitems_validation_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**MinitemsValidation**](../../models/MinitemsValidation.md) | | @@ -6141,9 +5914,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_minitems_validation_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_minitems_validation_request_body.response_for_200.ApiResponse) | success -#### post_minitems_validation_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -6158,8 +5931,6 @@ No authorization required # **post_minitems_validation_response_body_for_content_types** -> MinitemsValidation post_minitems_validation_response_body_for_content_types() - ### Example @@ -6167,7 +5938,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import path_post_api -from unit_test_api.model.minitems_validation import MinitemsValidation from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -6195,16 +5965,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_minitems_validation_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_minitems_validation_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_minitems_validation_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_minitems_validation_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**MinitemsValidation**](../../models/MinitemsValidation.md) | | @@ -6218,8 +5988,6 @@ No authorization required # **post_minlength_validation_request_body** -> post_minlength_validation_request_body(body) - ### Example @@ -6253,15 +6021,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_minlength_validation_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_minlength_validation_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**MinlengthValidation**](../../models/MinlengthValidation.md) | | @@ -6272,9 +6040,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_minlength_validation_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_minlength_validation_request_body.response_for_200.ApiResponse) | success -#### post_minlength_validation_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -6289,8 +6057,6 @@ No authorization required # **post_minlength_validation_response_body_for_content_types** -> MinlengthValidation post_minlength_validation_response_body_for_content_types() - ### Example @@ -6298,7 +6064,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import path_post_api -from unit_test_api.model.minlength_validation import MinlengthValidation from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -6326,16 +6091,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_minlength_validation_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_minlength_validation_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_minlength_validation_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_minlength_validation_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**MinlengthValidation**](../../models/MinlengthValidation.md) | | @@ -6349,8 +6114,6 @@ No authorization required # **post_minproperties_validation_request_body** -> post_minproperties_validation_request_body(body) - ### Example @@ -6384,15 +6147,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_minproperties_validation_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_minproperties_validation_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**MinpropertiesValidation**](../../models/MinpropertiesValidation.md) | | @@ -6403,9 +6166,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_minproperties_validation_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_minproperties_validation_request_body.response_for_200.ApiResponse) | success -#### post_minproperties_validation_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -6420,8 +6183,6 @@ No authorization required # **post_minproperties_validation_response_body_for_content_types** -> MinpropertiesValidation post_minproperties_validation_response_body_for_content_types() - ### Example @@ -6429,7 +6190,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import path_post_api -from unit_test_api.model.minproperties_validation import MinpropertiesValidation from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -6457,16 +6217,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_minproperties_validation_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_minproperties_validation_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_minproperties_validation_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_minproperties_validation_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**MinpropertiesValidation**](../../models/MinpropertiesValidation.md) | | @@ -6480,8 +6240,6 @@ No authorization required # **post_nested_allof_to_check_validation_semantics_request_body** -> post_nested_allof_to_check_validation_semantics_request_body(nested_allof_to_check_validation_semantics) - ### Example @@ -6515,15 +6273,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_nested_allof_to_check_validation_semantics_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_nested_allof_to_check_validation_semantics_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**NestedAllofToCheckValidationSemantics**](../../models/NestedAllofToCheckValidationSemantics.md) | | @@ -6534,9 +6292,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_nested_allof_to_check_validation_semantics_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_nested_allof_to_check_validation_semantics_request_body.response_for_200.ApiResponse) | success -#### post_nested_allof_to_check_validation_semantics_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -6551,8 +6309,6 @@ No authorization required # **post_nested_allof_to_check_validation_semantics_response_body_for_content_types** -> NestedAllofToCheckValidationSemantics post_nested_allof_to_check_validation_semantics_response_body_for_content_types() - ### Example @@ -6560,7 +6316,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import path_post_api -from unit_test_api.model.nested_allof_to_check_validation_semantics import NestedAllofToCheckValidationSemantics from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -6588,16 +6343,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_nested_allof_to_check_validation_semantics_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_nested_allof_to_check_validation_semantics_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_nested_allof_to_check_validation_semantics_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_nested_allof_to_check_validation_semantics_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**NestedAllofToCheckValidationSemantics**](../../models/NestedAllofToCheckValidationSemantics.md) | | @@ -6611,8 +6366,6 @@ No authorization required # **post_nested_anyof_to_check_validation_semantics_request_body** -> post_nested_anyof_to_check_validation_semantics_request_body(nested_anyof_to_check_validation_semantics) - ### Example @@ -6646,15 +6399,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_nested_anyof_to_check_validation_semantics_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_nested_anyof_to_check_validation_semantics_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**NestedAnyofToCheckValidationSemantics**](../../models/NestedAnyofToCheckValidationSemantics.md) | | @@ -6665,9 +6418,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_nested_anyof_to_check_validation_semantics_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_nested_anyof_to_check_validation_semantics_request_body.response_for_200.ApiResponse) | success -#### post_nested_anyof_to_check_validation_semantics_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -6682,8 +6435,6 @@ No authorization required # **post_nested_anyof_to_check_validation_semantics_response_body_for_content_types** -> NestedAnyofToCheckValidationSemantics post_nested_anyof_to_check_validation_semantics_response_body_for_content_types() - ### Example @@ -6691,7 +6442,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import path_post_api -from unit_test_api.model.nested_anyof_to_check_validation_semantics import NestedAnyofToCheckValidationSemantics from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -6719,16 +6469,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_nested_anyof_to_check_validation_semantics_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_nested_anyof_to_check_validation_semantics_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_nested_anyof_to_check_validation_semantics_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_nested_anyof_to_check_validation_semantics_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**NestedAnyofToCheckValidationSemantics**](../../models/NestedAnyofToCheckValidationSemantics.md) | | @@ -6742,8 +6492,6 @@ No authorization required # **post_nested_items_request_body** -> post_nested_items_request_body(nested_items) - ### Example @@ -6785,15 +6533,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_nested_items_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_nested_items_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**NestedItems**](../../models/NestedItems.md) | | @@ -6804,9 +6552,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_nested_items_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_nested_items_request_body.response_for_200.ApiResponse) | success -#### post_nested_items_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -6821,8 +6569,6 @@ No authorization required # **post_nested_items_response_body_for_content_types** -> NestedItems post_nested_items_response_body_for_content_types() - ### Example @@ -6830,7 +6576,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import path_post_api -from unit_test_api.model.nested_items import NestedItems from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -6858,16 +6603,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_nested_items_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_nested_items_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_nested_items_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_nested_items_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**NestedItems**](../../models/NestedItems.md) | | @@ -6881,8 +6626,6 @@ No authorization required # **post_nested_oneof_to_check_validation_semantics_request_body** -> post_nested_oneof_to_check_validation_semantics_request_body(nested_oneof_to_check_validation_semantics) - ### Example @@ -6916,15 +6659,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_nested_oneof_to_check_validation_semantics_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_nested_oneof_to_check_validation_semantics_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**NestedOneofToCheckValidationSemantics**](../../models/NestedOneofToCheckValidationSemantics.md) | | @@ -6935,9 +6678,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_nested_oneof_to_check_validation_semantics_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_nested_oneof_to_check_validation_semantics_request_body.response_for_200.ApiResponse) | success -#### post_nested_oneof_to_check_validation_semantics_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -6952,8 +6695,6 @@ No authorization required # **post_nested_oneof_to_check_validation_semantics_response_body_for_content_types** -> NestedOneofToCheckValidationSemantics post_nested_oneof_to_check_validation_semantics_response_body_for_content_types() - ### Example @@ -6961,7 +6702,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import path_post_api -from unit_test_api.model.nested_oneof_to_check_validation_semantics import NestedOneofToCheckValidationSemantics from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -6989,16 +6729,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_nested_oneof_to_check_validation_semantics_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_nested_oneof_to_check_validation_semantics_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_nested_oneof_to_check_validation_semantics_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_nested_oneof_to_check_validation_semantics_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**NestedOneofToCheckValidationSemantics**](../../models/NestedOneofToCheckValidationSemantics.md) | | @@ -7012,8 +6752,6 @@ No authorization required # **post_not_more_complex_schema_request_body** -> post_not_more_complex_schema_request_body(body) - ### Example @@ -7021,6 +6759,7 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import path_post_api +from unit_test_api.model.not_more_complex_schema import NotMoreComplexSchema from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -7034,7 +6773,7 @@ with unit_test_api.ApiClient(configuration) as api_client: api_instance = path_post_api.PathPostApi(api_client) # example passing only required values which don't have defaults set - body = None + body = NotMoreComplexSchema(None) try: api_response = api_instance.post_not_more_complex_schema_request_body( body=body, @@ -7046,48 +6785,28 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_not_more_complex_schema_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_not_more_complex_schema_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body - -# SchemaForRequestBodyApplicationJson - -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, | frozendict.frozendict, str, decimal.Decimal, BoolClass, NoneClass, tuple, bytes, FileIO | | - -### Composed Schemas (allOf/anyOf/oneOf/not) -#### not -Class Name | Input Type | Accessed Type | Description | Notes -------------- | ------------- | ------------- | ------------- | ------------- -[not_schema](#not_schema) | dict, frozendict.frozendict, | frozendict.frozendict, | | +### body -# not_schema - -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, | frozendict.frozendict, | | +# RequestBody.Schemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**NotMoreComplexSchema**](../../models/NotMoreComplexSchema.md) | | -### Dictionary Keys -Key | Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- | ------------- -**foo** | str, | str, | | [optional] -**any_string_name** | dict, frozendict.frozendict, str, date, datetime, int, float, bool, decimal.Decimal, None, list, tuple, bytes, io.FileIO, io.BufferedReader | frozendict.frozendict, str, BoolClass, decimal.Decimal, NoneClass, tuple, bytes, FileIO | any string name can be used but the value must be the correct type | [optional] ### Return Types, Responses Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_not_more_complex_schema_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_not_more_complex_schema_request_body.response_for_200.ApiResponse) | success -#### post_not_more_complex_schema_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -7102,8 +6821,6 @@ No authorization required # **post_not_more_complex_schema_response_body_for_content_types** -> bool, date, datetime, dict, float, int, list, str, none_type post_not_more_complex_schema_response_body_for_content_types() - ### Example @@ -7138,40 +6855,20 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_not_more_complex_schema_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_not_more_complex_schema_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_not_more_complex_schema_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_not_more_complex_schema_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson - -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, | frozendict.frozendict, str, decimal.Decimal, BoolClass, NoneClass, tuple, bytes, FileIO | | - -### Composed Schemas (allOf/anyOf/oneOf/not) -#### not -Class Name | Input Type | Accessed Type | Description | Notes -------------- | ------------- | ------------- | ------------- | ------------- -[not_schema](#not_schema) | dict, frozendict.frozendict, | frozendict.frozendict, | | - -# not_schema - -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, | frozendict.frozendict, | | +# response_for_200.BodySchemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**NotMoreComplexSchema**](../../models/NotMoreComplexSchema.md) | | -### Dictionary Keys -Key | Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- | ------------- -**foo** | str, | str, | | [optional] -**any_string_name** | dict, frozendict.frozendict, str, date, datetime, int, float, bool, decimal.Decimal, None, list, tuple, bytes, io.FileIO, io.BufferedReader | frozendict.frozendict, str, BoolClass, decimal.Decimal, NoneClass, tuple, bytes, FileIO | any string name can be used but the value must be the correct type | [optional] ### Authorization @@ -7181,8 +6878,6 @@ No authorization required # **post_not_request_body** -> post_not_request_body(body) - ### Example @@ -7190,6 +6885,7 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import path_post_api +from unit_test_api.model.model_not import ModelNot from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -7203,7 +6899,7 @@ with unit_test_api.ApiClient(configuration) as api_client: api_instance = path_post_api.PathPostApi(api_client) # example passing only required values which don't have defaults set - body = None + body = ModelNot(None) try: api_response = api_instance.post_not_request_body( body=body, @@ -7215,42 +6911,28 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_not_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_not_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson - -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, | frozendict.frozendict, str, decimal.Decimal, BoolClass, NoneClass, tuple, bytes, FileIO | | - -### Composed Schemas (allOf/anyOf/oneOf/not) -#### not -Class Name | Input Type | Accessed Type | Description | Notes -------------- | ------------- | ------------- | ------------- | ------------- -[not_schema](#not_schema) | decimal.Decimal, int, | decimal.Decimal, | | - -# not_schema +# RequestBody.Schemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**ModelNot**](../../models/ModelNot.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -decimal.Decimal, int, | decimal.Decimal, | | ### Return Types, Responses Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_not_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_not_request_body.response_for_200.ApiResponse) | success -#### post_not_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -7265,8 +6947,6 @@ No authorization required # **post_not_response_body_for_content_types** -> bool, date, datetime, dict, float, int, list, str, none_type post_not_response_body_for_content_types() - ### Example @@ -7301,34 +6981,20 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_not_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_not_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_not_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_not_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson - -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, | frozendict.frozendict, str, decimal.Decimal, BoolClass, NoneClass, tuple, bytes, FileIO | | - -### Composed Schemas (allOf/anyOf/oneOf/not) -#### not -Class Name | Input Type | Accessed Type | Description | Notes -------------- | ------------- | ------------- | ------------- | ------------- -[not_schema](#not_schema) | decimal.Decimal, int, | decimal.Decimal, | | - -# not_schema +# response_for_200.BodySchemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**ModelNot**](../../models/ModelNot.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -decimal.Decimal, int, | decimal.Decimal, | | ### Authorization @@ -7338,8 +7004,6 @@ No authorization required # **post_nul_characters_in_strings_request_body** -> post_nul_characters_in_strings_request_body(body) - ### Example @@ -7373,15 +7037,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_nul_characters_in_strings_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_nul_characters_in_strings_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**NulCharactersInStrings**](../../models/NulCharactersInStrings.md) | | @@ -7392,9 +7056,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_nul_characters_in_strings_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_nul_characters_in_strings_request_body.response_for_200.ApiResponse) | success -#### post_nul_characters_in_strings_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -7409,8 +7073,6 @@ No authorization required # **post_nul_characters_in_strings_response_body_for_content_types** -> NulCharactersInStrings post_nul_characters_in_strings_response_body_for_content_types() - ### Example @@ -7418,7 +7080,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import path_post_api -from unit_test_api.model.nul_characters_in_strings import NulCharactersInStrings from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -7446,16 +7107,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_nul_characters_in_strings_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_nul_characters_in_strings_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_nul_characters_in_strings_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_nul_characters_in_strings_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**NulCharactersInStrings**](../../models/NulCharactersInStrings.md) | | @@ -7469,8 +7130,6 @@ No authorization required # **post_null_type_matches_only_the_null_object_request_body** -> post_null_type_matches_only_the_null_object_request_body(body) - ### Example @@ -7478,6 +7137,7 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import path_post_api +from unit_test_api.model.null_type_matches_only_the_null_object import NullTypeMatchesOnlyTheNullObject from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -7491,7 +7151,7 @@ with unit_test_api.ApiClient(configuration) as api_client: api_instance = path_post_api.PathPostApi(api_client) # example passing only required values which don't have defaults set - body = None + body = NullTypeMatchesOnlyTheNullObject(None) try: api_response = api_instance.post_null_type_matches_only_the_null_object_request_body( body=body, @@ -7503,29 +7163,28 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_null_type_matches_only_the_null_object_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_null_type_matches_only_the_null_object_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**NullTypeMatchesOnlyTheNullObject**](../../models/NullTypeMatchesOnlyTheNullObject.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -None, | NoneClass, | | ### Return Types, Responses Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_null_type_matches_only_the_null_object_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_null_type_matches_only_the_null_object_request_body.response_for_200.ApiResponse) | success -#### post_null_type_matches_only_the_null_object_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -7540,8 +7199,6 @@ No authorization required # **post_null_type_matches_only_the_null_object_response_body_for_content_types** -> none_type post_null_type_matches_only_the_null_object_response_body_for_content_types() - ### Example @@ -7576,21 +7233,20 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_null_type_matches_only_the_null_object_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_null_type_matches_only_the_null_object_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_null_type_matches_only_the_null_object_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_null_type_matches_only_the_null_object_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**NullTypeMatchesOnlyTheNullObject**](../../models/NullTypeMatchesOnlyTheNullObject.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -None, | NoneClass, | | ### Authorization @@ -7600,8 +7256,6 @@ No authorization required # **post_number_type_matches_numbers_request_body** -> post_number_type_matches_numbers_request_body(body) - ### Example @@ -7609,6 +7263,7 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import path_post_api +from unit_test_api.model.number_type_matches_numbers import NumberTypeMatchesNumbers from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -7622,7 +7277,7 @@ with unit_test_api.ApiClient(configuration) as api_client: api_instance = path_post_api.PathPostApi(api_client) # example passing only required values which don't have defaults set - body = 3.14 + body = NumberTypeMatchesNumbers(3.14) try: api_response = api_instance.post_number_type_matches_numbers_request_body( body=body, @@ -7634,29 +7289,28 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_number_type_matches_numbers_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_number_type_matches_numbers_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**NumberTypeMatchesNumbers**](../../models/NumberTypeMatchesNumbers.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -decimal.Decimal, int, float, | decimal.Decimal, | | ### Return Types, Responses Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_number_type_matches_numbers_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_number_type_matches_numbers_request_body.response_for_200.ApiResponse) | success -#### post_number_type_matches_numbers_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -7671,8 +7325,6 @@ No authorization required # **post_number_type_matches_numbers_response_body_for_content_types** -> int, float post_number_type_matches_numbers_response_body_for_content_types() - ### Example @@ -7707,21 +7359,20 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_number_type_matches_numbers_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_number_type_matches_numbers_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_number_type_matches_numbers_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_number_type_matches_numbers_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**NumberTypeMatchesNumbers**](../../models/NumberTypeMatchesNumbers.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -decimal.Decimal, int, float, | decimal.Decimal, | | ### Authorization @@ -7731,8 +7382,6 @@ No authorization required # **post_object_properties_validation_request_body** -> post_object_properties_validation_request_body(object_properties_validation) - ### Example @@ -7766,15 +7415,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_object_properties_validation_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_object_properties_validation_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**ObjectPropertiesValidation**](../../models/ObjectPropertiesValidation.md) | | @@ -7785,9 +7434,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_object_properties_validation_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_object_properties_validation_request_body.response_for_200.ApiResponse) | success -#### post_object_properties_validation_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -7802,8 +7451,6 @@ No authorization required # **post_object_properties_validation_response_body_for_content_types** -> ObjectPropertiesValidation post_object_properties_validation_response_body_for_content_types() - ### Example @@ -7811,7 +7458,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import path_post_api -from unit_test_api.model.object_properties_validation import ObjectPropertiesValidation from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -7839,16 +7485,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_object_properties_validation_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_object_properties_validation_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_object_properties_validation_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_object_properties_validation_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**ObjectPropertiesValidation**](../../models/ObjectPropertiesValidation.md) | | @@ -7862,8 +7508,6 @@ No authorization required # **post_object_type_matches_objects_request_body** -> post_object_type_matches_objects_request_body(body) - ### Example @@ -7871,6 +7515,7 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import path_post_api +from unit_test_api.model.object_type_matches_objects import ObjectTypeMatchesObjects from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -7884,7 +7529,7 @@ with unit_test_api.ApiClient(configuration) as api_client: api_instance = path_post_api.PathPostApi(api_client) # example passing only required values which don't have defaults set - body = dict() + body = ObjectTypeMatchesObjects() try: api_response = api_instance.post_object_type_matches_objects_request_body( body=body, @@ -7896,29 +7541,28 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_object_type_matches_objects_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_object_type_matches_objects_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**ObjectTypeMatchesObjects**](../../models/ObjectTypeMatchesObjects.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, | frozendict.frozendict, | | ### Return Types, Responses Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_object_type_matches_objects_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_object_type_matches_objects_request_body.response_for_200.ApiResponse) | success -#### post_object_type_matches_objects_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -7933,8 +7577,6 @@ No authorization required # **post_object_type_matches_objects_response_body_for_content_types** -> {str: (bool, date, datetime, dict, float, int, list, str, none_type)} post_object_type_matches_objects_response_body_for_content_types() - ### Example @@ -7969,21 +7611,20 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_object_type_matches_objects_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_object_type_matches_objects_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_object_type_matches_objects_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_object_type_matches_objects_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**ObjectTypeMatchesObjects**](../../models/ObjectTypeMatchesObjects.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, | frozendict.frozendict, | | ### Authorization @@ -7993,8 +7634,6 @@ No authorization required # **post_oneof_complex_types_request_body** -> post_oneof_complex_types_request_body(oneof_complex_types) - ### Example @@ -8028,15 +7667,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_oneof_complex_types_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_oneof_complex_types_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**OneofComplexTypes**](../../models/OneofComplexTypes.md) | | @@ -8047,9 +7686,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_oneof_complex_types_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_oneof_complex_types_request_body.response_for_200.ApiResponse) | success -#### post_oneof_complex_types_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -8064,8 +7703,6 @@ No authorization required # **post_oneof_complex_types_response_body_for_content_types** -> OneofComplexTypes post_oneof_complex_types_response_body_for_content_types() - ### Example @@ -8073,7 +7710,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import path_post_api -from unit_test_api.model.oneof_complex_types import OneofComplexTypes from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -8101,16 +7737,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_oneof_complex_types_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_oneof_complex_types_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_oneof_complex_types_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_oneof_complex_types_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**OneofComplexTypes**](../../models/OneofComplexTypes.md) | | @@ -8124,8 +7760,6 @@ No authorization required # **post_oneof_request_body** -> post_oneof_request_body(oneof) - ### Example @@ -8159,15 +7793,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_oneof_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_oneof_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**Oneof**](../../models/Oneof.md) | | @@ -8178,9 +7812,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_oneof_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_oneof_request_body.response_for_200.ApiResponse) | success -#### post_oneof_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -8195,8 +7829,6 @@ No authorization required # **post_oneof_response_body_for_content_types** -> Oneof post_oneof_response_body_for_content_types() - ### Example @@ -8204,7 +7836,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import path_post_api -from unit_test_api.model.oneof import Oneof from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -8232,16 +7863,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_oneof_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_oneof_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_oneof_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_oneof_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**Oneof**](../../models/Oneof.md) | | @@ -8255,8 +7886,6 @@ No authorization required # **post_oneof_with_base_schema_request_body** -> post_oneof_with_base_schema_request_body(body) - ### Example @@ -8290,15 +7919,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_oneof_with_base_schema_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_oneof_with_base_schema_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**OneofWithBaseSchema**](../../models/OneofWithBaseSchema.md) | | @@ -8309,9 +7938,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_oneof_with_base_schema_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_oneof_with_base_schema_request_body.response_for_200.ApiResponse) | success -#### post_oneof_with_base_schema_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -8326,8 +7955,6 @@ No authorization required # **post_oneof_with_base_schema_response_body_for_content_types** -> OneofWithBaseSchema post_oneof_with_base_schema_response_body_for_content_types() - ### Example @@ -8335,7 +7962,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import path_post_api -from unit_test_api.model.oneof_with_base_schema import OneofWithBaseSchema from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -8363,16 +7989,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_oneof_with_base_schema_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_oneof_with_base_schema_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_oneof_with_base_schema_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_oneof_with_base_schema_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**OneofWithBaseSchema**](../../models/OneofWithBaseSchema.md) | | @@ -8386,8 +8012,6 @@ No authorization required # **post_oneof_with_empty_schema_request_body** -> post_oneof_with_empty_schema_request_body(oneof_with_empty_schema) - ### Example @@ -8421,15 +8045,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_oneof_with_empty_schema_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_oneof_with_empty_schema_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**OneofWithEmptySchema**](../../models/OneofWithEmptySchema.md) | | @@ -8440,9 +8064,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_oneof_with_empty_schema_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_oneof_with_empty_schema_request_body.response_for_200.ApiResponse) | success -#### post_oneof_with_empty_schema_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -8457,8 +8081,6 @@ No authorization required # **post_oneof_with_empty_schema_response_body_for_content_types** -> OneofWithEmptySchema post_oneof_with_empty_schema_response_body_for_content_types() - ### Example @@ -8466,7 +8088,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import path_post_api -from unit_test_api.model.oneof_with_empty_schema import OneofWithEmptySchema from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -8494,16 +8115,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_oneof_with_empty_schema_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_oneof_with_empty_schema_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_oneof_with_empty_schema_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_oneof_with_empty_schema_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**OneofWithEmptySchema**](../../models/OneofWithEmptySchema.md) | | @@ -8517,8 +8138,6 @@ No authorization required # **post_oneof_with_required_request_body** -> post_oneof_with_required_request_body(oneof_with_required) - ### Example @@ -8552,15 +8171,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_oneof_with_required_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_oneof_with_required_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**OneofWithRequired**](../../models/OneofWithRequired.md) | | @@ -8571,9 +8190,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_oneof_with_required_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_oneof_with_required_request_body.response_for_200.ApiResponse) | success -#### post_oneof_with_required_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -8588,8 +8207,6 @@ No authorization required # **post_oneof_with_required_response_body_for_content_types** -> OneofWithRequired post_oneof_with_required_response_body_for_content_types() - ### Example @@ -8597,7 +8214,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import path_post_api -from unit_test_api.model.oneof_with_required import OneofWithRequired from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -8625,16 +8241,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_oneof_with_required_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_oneof_with_required_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_oneof_with_required_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_oneof_with_required_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**OneofWithRequired**](../../models/OneofWithRequired.md) | | @@ -8648,8 +8264,6 @@ No authorization required # **post_pattern_is_not_anchored_request_body** -> post_pattern_is_not_anchored_request_body(body) - ### Example @@ -8683,15 +8297,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_pattern_is_not_anchored_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_pattern_is_not_anchored_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**PatternIsNotAnchored**](../../models/PatternIsNotAnchored.md) | | @@ -8702,9 +8316,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_pattern_is_not_anchored_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_pattern_is_not_anchored_request_body.response_for_200.ApiResponse) | success -#### post_pattern_is_not_anchored_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -8719,8 +8333,6 @@ No authorization required # **post_pattern_is_not_anchored_response_body_for_content_types** -> PatternIsNotAnchored post_pattern_is_not_anchored_response_body_for_content_types() - ### Example @@ -8728,7 +8340,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import path_post_api -from unit_test_api.model.pattern_is_not_anchored import PatternIsNotAnchored from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -8756,16 +8367,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_pattern_is_not_anchored_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_pattern_is_not_anchored_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_pattern_is_not_anchored_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_pattern_is_not_anchored_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**PatternIsNotAnchored**](../../models/PatternIsNotAnchored.md) | | @@ -8779,8 +8390,6 @@ No authorization required # **post_pattern_validation_request_body** -> post_pattern_validation_request_body(body) - ### Example @@ -8814,15 +8423,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_pattern_validation_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_pattern_validation_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**PatternValidation**](../../models/PatternValidation.md) | | @@ -8833,9 +8442,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_pattern_validation_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_pattern_validation_request_body.response_for_200.ApiResponse) | success -#### post_pattern_validation_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -8850,8 +8459,6 @@ No authorization required # **post_pattern_validation_response_body_for_content_types** -> PatternValidation post_pattern_validation_response_body_for_content_types() - ### Example @@ -8859,7 +8466,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import path_post_api -from unit_test_api.model.pattern_validation import PatternValidation from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -8887,16 +8493,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_pattern_validation_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_pattern_validation_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_pattern_validation_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_pattern_validation_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**PatternValidation**](../../models/PatternValidation.md) | | @@ -8910,8 +8516,6 @@ No authorization required # **post_properties_with_escaped_characters_request_body** -> post_properties_with_escaped_characters_request_body(properties_with_escaped_characters) - ### Example @@ -8945,15 +8549,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_properties_with_escaped_characters_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_properties_with_escaped_characters_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**PropertiesWithEscapedCharacters**](../../models/PropertiesWithEscapedCharacters.md) | | @@ -8964,9 +8568,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_properties_with_escaped_characters_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_properties_with_escaped_characters_request_body.response_for_200.ApiResponse) | success -#### post_properties_with_escaped_characters_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -8981,8 +8585,6 @@ No authorization required # **post_properties_with_escaped_characters_response_body_for_content_types** -> PropertiesWithEscapedCharacters post_properties_with_escaped_characters_response_body_for_content_types() - ### Example @@ -8990,7 +8592,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import path_post_api -from unit_test_api.model.properties_with_escaped_characters import PropertiesWithEscapedCharacters from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -9018,16 +8619,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_properties_with_escaped_characters_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_properties_with_escaped_characters_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_properties_with_escaped_characters_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_properties_with_escaped_characters_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**PropertiesWithEscapedCharacters**](../../models/PropertiesWithEscapedCharacters.md) | | @@ -9041,8 +8642,6 @@ No authorization required # **post_property_named_ref_that_is_not_a_reference_request_body** -> post_property_named_ref_that_is_not_a_reference_request_body(property_named_ref_that_is_not_a_reference) - ### Example @@ -9076,15 +8675,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_property_named_ref_that_is_not_a_reference_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_property_named_ref_that_is_not_a_reference_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**PropertyNamedRefThatIsNotAReference**](../../models/PropertyNamedRefThatIsNotAReference.md) | | @@ -9095,9 +8694,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_property_named_ref_that_is_not_a_reference_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_property_named_ref_that_is_not_a_reference_request_body.response_for_200.ApiResponse) | success -#### post_property_named_ref_that_is_not_a_reference_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -9112,8 +8711,6 @@ No authorization required # **post_property_named_ref_that_is_not_a_reference_response_body_for_content_types** -> PropertyNamedRefThatIsNotAReference post_property_named_ref_that_is_not_a_reference_response_body_for_content_types() - ### Example @@ -9121,7 +8718,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import path_post_api -from unit_test_api.model.property_named_ref_that_is_not_a_reference import PropertyNamedRefThatIsNotAReference from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -9149,16 +8745,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_property_named_ref_that_is_not_a_reference_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_property_named_ref_that_is_not_a_reference_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_property_named_ref_that_is_not_a_reference_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_property_named_ref_that_is_not_a_reference_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**PropertyNamedRefThatIsNotAReference**](../../models/PropertyNamedRefThatIsNotAReference.md) | | @@ -9172,8 +8768,6 @@ No authorization required # **post_ref_in_additionalproperties_request_body** -> post_ref_in_additionalproperties_request_body(ref_in_additionalproperties) - ### Example @@ -9209,15 +8803,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_ref_in_additionalproperties_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_ref_in_additionalproperties_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**RefInAdditionalproperties**](../../models/RefInAdditionalproperties.md) | | @@ -9228,9 +8822,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_ref_in_additionalproperties_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_ref_in_additionalproperties_request_body.response_for_200.ApiResponse) | success -#### post_ref_in_additionalproperties_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -9245,8 +8839,6 @@ No authorization required # **post_ref_in_additionalproperties_response_body_for_content_types** -> RefInAdditionalproperties post_ref_in_additionalproperties_response_body_for_content_types() - ### Example @@ -9254,7 +8846,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import path_post_api -from unit_test_api.model.ref_in_additionalproperties import RefInAdditionalproperties from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -9282,16 +8873,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_ref_in_additionalproperties_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_ref_in_additionalproperties_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_ref_in_additionalproperties_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_ref_in_additionalproperties_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**RefInAdditionalproperties**](../../models/RefInAdditionalproperties.md) | | @@ -9305,8 +8896,6 @@ No authorization required # **post_ref_in_allof_request_body** -> post_ref_in_allof_request_body(ref_in_allof) - ### Example @@ -9340,15 +8929,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_ref_in_allof_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_ref_in_allof_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**RefInAllof**](../../models/RefInAllof.md) | | @@ -9359,9 +8948,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_ref_in_allof_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_ref_in_allof_request_body.response_for_200.ApiResponse) | success -#### post_ref_in_allof_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -9376,8 +8965,6 @@ No authorization required # **post_ref_in_allof_response_body_for_content_types** -> RefInAllof post_ref_in_allof_response_body_for_content_types() - ### Example @@ -9385,7 +8972,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import path_post_api -from unit_test_api.model.ref_in_allof import RefInAllof from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -9413,16 +8999,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_ref_in_allof_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_ref_in_allof_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_ref_in_allof_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_ref_in_allof_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**RefInAllof**](../../models/RefInAllof.md) | | @@ -9436,8 +9022,6 @@ No authorization required # **post_ref_in_anyof_request_body** -> post_ref_in_anyof_request_body(ref_in_anyof) - ### Example @@ -9471,15 +9055,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_ref_in_anyof_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_ref_in_anyof_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**RefInAnyof**](../../models/RefInAnyof.md) | | @@ -9490,9 +9074,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_ref_in_anyof_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_ref_in_anyof_request_body.response_for_200.ApiResponse) | success -#### post_ref_in_anyof_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -9507,8 +9091,6 @@ No authorization required # **post_ref_in_anyof_response_body_for_content_types** -> RefInAnyof post_ref_in_anyof_response_body_for_content_types() - ### Example @@ -9516,7 +9098,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import path_post_api -from unit_test_api.model.ref_in_anyof import RefInAnyof from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -9544,16 +9125,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_ref_in_anyof_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_ref_in_anyof_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_ref_in_anyof_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_ref_in_anyof_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**RefInAnyof**](../../models/RefInAnyof.md) | | @@ -9567,8 +9148,6 @@ No authorization required # **post_ref_in_items_request_body** -> post_ref_in_items_request_body(ref_in_items) - ### Example @@ -9604,15 +9183,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_ref_in_items_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_ref_in_items_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**RefInItems**](../../models/RefInItems.md) | | @@ -9623,9 +9202,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_ref_in_items_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_ref_in_items_request_body.response_for_200.ApiResponse) | success -#### post_ref_in_items_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -9640,8 +9219,6 @@ No authorization required # **post_ref_in_items_response_body_for_content_types** -> RefInItems post_ref_in_items_response_body_for_content_types() - ### Example @@ -9649,7 +9226,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import path_post_api -from unit_test_api.model.ref_in_items import RefInItems from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -9677,16 +9253,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_ref_in_items_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_ref_in_items_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_ref_in_items_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_ref_in_items_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**RefInItems**](../../models/RefInItems.md) | | @@ -9700,8 +9276,6 @@ No authorization required # **post_ref_in_not_request_body** -> post_ref_in_not_request_body(body) - ### Example @@ -9709,7 +9283,7 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import path_post_api -from unit_test_api.model.property_named_ref_that_is_not_a_reference import PropertyNamedRefThatIsNotAReference +from unit_test_api.model.ref_in_not import RefInNot from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -9723,7 +9297,7 @@ with unit_test_api.ApiClient(configuration) as api_client: api_instance = path_post_api.PathPostApi(api_client) # example passing only required values which don't have defaults set - body = None + body = RefInNot(None) try: api_response = api_instance.post_ref_in_not_request_body( body=body, @@ -9735,35 +9309,28 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_ref_in_not_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_ref_in_not_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson - -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, | frozendict.frozendict, str, decimal.Decimal, BoolClass, NoneClass, tuple, bytes, FileIO | | +# RequestBody.Schemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**RefInNot**](../../models/RefInNot.md) | | -### Composed Schemas (allOf/anyOf/oneOf/not) -#### not -Class Name | Input Type | Accessed Type | Description | Notes -------------- | ------------- | ------------- | ------------- | ------------- -[PropertyNamedRefThatIsNotAReference]({{complexTypePrefix}}PropertyNamedRefThatIsNotAReference.md) | [**PropertyNamedRefThatIsNotAReference**]({{complexTypePrefix}}PropertyNamedRefThatIsNotAReference.md) | [**PropertyNamedRefThatIsNotAReference**]({{complexTypePrefix}}PropertyNamedRefThatIsNotAReference.md) | | ### Return Types, Responses Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_ref_in_not_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_ref_in_not_request_body.response_for_200.ApiResponse) | success -#### post_ref_in_not_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -9778,8 +9345,6 @@ No authorization required # **post_ref_in_not_response_body_for_content_types** -> bool, date, datetime, dict, float, int, list, str, none_type post_ref_in_not_response_body_for_content_types() - ### Example @@ -9787,7 +9352,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import path_post_api -from unit_test_api.model.property_named_ref_that_is_not_a_reference import PropertyNamedRefThatIsNotAReference from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -9815,27 +9379,20 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_ref_in_not_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_ref_in_not_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_ref_in_not_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_ref_in_not_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson - -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, | frozendict.frozendict, str, decimal.Decimal, BoolClass, NoneClass, tuple, bytes, FileIO | | +# response_for_200.BodySchemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**RefInNot**](../../models/RefInNot.md) | | -### Composed Schemas (allOf/anyOf/oneOf/not) -#### not -Class Name | Input Type | Accessed Type | Description | Notes -------------- | ------------- | ------------- | ------------- | ------------- -[PropertyNamedRefThatIsNotAReference]({{complexTypePrefix}}PropertyNamedRefThatIsNotAReference.md) | [**PropertyNamedRefThatIsNotAReference**]({{complexTypePrefix}}PropertyNamedRefThatIsNotAReference.md) | [**PropertyNamedRefThatIsNotAReference**]({{complexTypePrefix}}PropertyNamedRefThatIsNotAReference.md) | | ### Authorization @@ -9845,8 +9402,6 @@ No authorization required # **post_ref_in_oneof_request_body** -> post_ref_in_oneof_request_body(ref_in_oneof) - ### Example @@ -9880,15 +9435,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_ref_in_oneof_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_ref_in_oneof_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**RefInOneof**](../../models/RefInOneof.md) | | @@ -9899,9 +9454,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_ref_in_oneof_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_ref_in_oneof_request_body.response_for_200.ApiResponse) | success -#### post_ref_in_oneof_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -9916,8 +9471,6 @@ No authorization required # **post_ref_in_oneof_response_body_for_content_types** -> RefInOneof post_ref_in_oneof_response_body_for_content_types() - ### Example @@ -9925,7 +9478,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import path_post_api -from unit_test_api.model.ref_in_oneof import RefInOneof from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -9953,16 +9505,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_ref_in_oneof_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_ref_in_oneof_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_ref_in_oneof_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_ref_in_oneof_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**RefInOneof**](../../models/RefInOneof.md) | | @@ -9976,8 +9528,6 @@ No authorization required # **post_ref_in_property_request_body** -> post_ref_in_property_request_body(ref_in_property) - ### Example @@ -10011,15 +9561,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_ref_in_property_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_ref_in_property_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**RefInProperty**](../../models/RefInProperty.md) | | @@ -10030,9 +9580,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_ref_in_property_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_ref_in_property_request_body.response_for_200.ApiResponse) | success -#### post_ref_in_property_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -10047,8 +9597,6 @@ No authorization required # **post_ref_in_property_response_body_for_content_types** -> RefInProperty post_ref_in_property_response_body_for_content_types() - ### Example @@ -10056,7 +9604,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import path_post_api -from unit_test_api.model.ref_in_property import RefInProperty from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -10084,16 +9631,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_ref_in_property_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_ref_in_property_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_ref_in_property_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_ref_in_property_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**RefInProperty**](../../models/RefInProperty.md) | | @@ -10107,8 +9654,6 @@ No authorization required # **post_required_default_validation_request_body** -> post_required_default_validation_request_body(required_default_validation) - ### Example @@ -10142,15 +9687,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_required_default_validation_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_required_default_validation_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**RequiredDefaultValidation**](../../models/RequiredDefaultValidation.md) | | @@ -10161,9 +9706,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_required_default_validation_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_required_default_validation_request_body.response_for_200.ApiResponse) | success -#### post_required_default_validation_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -10178,8 +9723,6 @@ No authorization required # **post_required_default_validation_response_body_for_content_types** -> RequiredDefaultValidation post_required_default_validation_response_body_for_content_types() - ### Example @@ -10187,7 +9730,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import path_post_api -from unit_test_api.model.required_default_validation import RequiredDefaultValidation from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -10215,16 +9757,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_required_default_validation_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_required_default_validation_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_required_default_validation_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_required_default_validation_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**RequiredDefaultValidation**](../../models/RequiredDefaultValidation.md) | | @@ -10238,8 +9780,6 @@ No authorization required # **post_required_validation_request_body** -> post_required_validation_request_body(required_validation) - ### Example @@ -10273,15 +9813,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_required_validation_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_required_validation_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**RequiredValidation**](../../models/RequiredValidation.md) | | @@ -10292,9 +9832,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_required_validation_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_required_validation_request_body.response_for_200.ApiResponse) | success -#### post_required_validation_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -10309,8 +9849,6 @@ No authorization required # **post_required_validation_response_body_for_content_types** -> RequiredValidation post_required_validation_response_body_for_content_types() - ### Example @@ -10318,7 +9856,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import path_post_api -from unit_test_api.model.required_validation import RequiredValidation from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -10346,16 +9883,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_required_validation_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_required_validation_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_required_validation_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_required_validation_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**RequiredValidation**](../../models/RequiredValidation.md) | | @@ -10369,8 +9906,6 @@ No authorization required # **post_required_with_empty_array_request_body** -> post_required_with_empty_array_request_body(required_with_empty_array) - ### Example @@ -10404,15 +9939,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_required_with_empty_array_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_required_with_empty_array_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**RequiredWithEmptyArray**](../../models/RequiredWithEmptyArray.md) | | @@ -10423,9 +9958,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_required_with_empty_array_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_required_with_empty_array_request_body.response_for_200.ApiResponse) | success -#### post_required_with_empty_array_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -10440,8 +9975,6 @@ No authorization required # **post_required_with_empty_array_response_body_for_content_types** -> RequiredWithEmptyArray post_required_with_empty_array_response_body_for_content_types() - ### Example @@ -10449,7 +9982,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import path_post_api -from unit_test_api.model.required_with_empty_array import RequiredWithEmptyArray from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -10477,16 +10009,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_required_with_empty_array_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_required_with_empty_array_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_required_with_empty_array_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_required_with_empty_array_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**RequiredWithEmptyArray**](../../models/RequiredWithEmptyArray.md) | | @@ -10500,8 +10032,6 @@ No authorization required # **post_required_with_escaped_characters_request_body** -> post_required_with_escaped_characters_request_body(body) - ### Example @@ -10509,6 +10039,7 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import path_post_api +from unit_test_api.model.required_with_escaped_characters import RequiredWithEscapedCharacters from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -10522,7 +10053,7 @@ with unit_test_api.ApiClient(configuration) as api_client: api_instance = path_post_api.PathPostApi(api_client) # example passing only required values which don't have defaults set - body = None + body = RequiredWithEscapedCharacters(None) try: api_response = api_instance.post_required_with_escaped_characters_request_body( body=body, @@ -10534,29 +10065,28 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_required_with_escaped_characters_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_required_with_escaped_characters_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**RequiredWithEscapedCharacters**](../../models/RequiredWithEscapedCharacters.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, | frozendict.frozendict, str, decimal.Decimal, BoolClass, NoneClass, tuple, bytes, FileIO | | ### Return Types, Responses Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_required_with_escaped_characters_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_required_with_escaped_characters_request_body.response_for_200.ApiResponse) | success -#### post_required_with_escaped_characters_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -10571,8 +10101,6 @@ No authorization required # **post_required_with_escaped_characters_response_body_for_content_types** -> bool, date, datetime, dict, float, int, list, str, none_type post_required_with_escaped_characters_response_body_for_content_types() - ### Example @@ -10607,21 +10135,20 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_required_with_escaped_characters_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_required_with_escaped_characters_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_required_with_escaped_characters_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_required_with_escaped_characters_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**RequiredWithEscapedCharacters**](../../models/RequiredWithEscapedCharacters.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, | frozendict.frozendict, str, decimal.Decimal, BoolClass, NoneClass, tuple, bytes, FileIO | | ### Authorization @@ -10631,8 +10158,6 @@ No authorization required # **post_simple_enum_validation_request_body** -> post_simple_enum_validation_request_body(body) - ### Example @@ -10666,15 +10191,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_simple_enum_validation_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_simple_enum_validation_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**SimpleEnumValidation**](../../models/SimpleEnumValidation.md) | | @@ -10685,9 +10210,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_simple_enum_validation_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_simple_enum_validation_request_body.response_for_200.ApiResponse) | success -#### post_simple_enum_validation_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -10702,8 +10227,6 @@ No authorization required # **post_simple_enum_validation_response_body_for_content_types** -> SimpleEnumValidation post_simple_enum_validation_response_body_for_content_types() - ### Example @@ -10711,7 +10234,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import path_post_api -from unit_test_api.model.simple_enum_validation import SimpleEnumValidation from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -10739,16 +10261,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_simple_enum_validation_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_simple_enum_validation_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_simple_enum_validation_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_simple_enum_validation_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**SimpleEnumValidation**](../../models/SimpleEnumValidation.md) | | @@ -10762,8 +10284,6 @@ No authorization required # **post_string_type_matches_strings_request_body** -> post_string_type_matches_strings_request_body(body) - ### Example @@ -10771,6 +10291,7 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import path_post_api +from unit_test_api.model.string_type_matches_strings import StringTypeMatchesStrings from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -10784,7 +10305,7 @@ with unit_test_api.ApiClient(configuration) as api_client: api_instance = path_post_api.PathPostApi(api_client) # example passing only required values which don't have defaults set - body = "body_example" + body = StringTypeMatchesStrings("body_example") try: api_response = api_instance.post_string_type_matches_strings_request_body( body=body, @@ -10796,29 +10317,28 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_string_type_matches_strings_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_string_type_matches_strings_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**StringTypeMatchesStrings**](../../models/StringTypeMatchesStrings.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -str, | str, | | ### Return Types, Responses Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_string_type_matches_strings_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_string_type_matches_strings_request_body.response_for_200.ApiResponse) | success -#### post_string_type_matches_strings_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -10833,8 +10353,6 @@ No authorization required # **post_string_type_matches_strings_response_body_for_content_types** -> str post_string_type_matches_strings_response_body_for_content_types() - ### Example @@ -10869,21 +10387,20 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_string_type_matches_strings_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_string_type_matches_strings_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_string_type_matches_strings_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_string_type_matches_strings_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**StringTypeMatchesStrings**](../../models/StringTypeMatchesStrings.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -str, | str, | | ### Authorization @@ -10893,8 +10410,6 @@ No authorization required # **post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_request_body** -> post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_request_body(the_default_keyword_does_not_do_anything_if_the_property_is_missing) - ### Example @@ -10930,15 +10445,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing**](../../models/TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.md) | | @@ -10949,9 +10464,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_request_body.response_for_200.ApiResponse) | success -#### post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -10966,8 +10481,6 @@ No authorization required # **post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_response_body_for_content_types** -> TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_response_body_for_content_types() - ### Example @@ -10975,7 +10488,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import path_post_api -from unit_test_api.model.the_default_keyword_does_not_do_anything_if_the_property_is_missing import TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -11003,16 +10515,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing**](../../models/TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.md) | | @@ -11026,8 +10538,6 @@ No authorization required # **post_uniqueitems_false_validation_request_body** -> post_uniqueitems_false_validation_request_body(body) - ### Example @@ -11061,15 +10571,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_uniqueitems_false_validation_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_uniqueitems_false_validation_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**UniqueitemsFalseValidation**](../../models/UniqueitemsFalseValidation.md) | | @@ -11080,9 +10590,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_uniqueitems_false_validation_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_uniqueitems_false_validation_request_body.response_for_200.ApiResponse) | success -#### post_uniqueitems_false_validation_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -11097,8 +10607,6 @@ No authorization required # **post_uniqueitems_false_validation_response_body_for_content_types** -> UniqueitemsFalseValidation post_uniqueitems_false_validation_response_body_for_content_types() - ### Example @@ -11106,7 +10614,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import path_post_api -from unit_test_api.model.uniqueitems_false_validation import UniqueitemsFalseValidation from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -11134,16 +10641,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_uniqueitems_false_validation_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_uniqueitems_false_validation_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_uniqueitems_false_validation_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_uniqueitems_false_validation_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**UniqueitemsFalseValidation**](../../models/UniqueitemsFalseValidation.md) | | @@ -11157,8 +10664,6 @@ No authorization required # **post_uniqueitems_validation_request_body** -> post_uniqueitems_validation_request_body(body) - ### Example @@ -11192,15 +10697,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_uniqueitems_validation_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_uniqueitems_validation_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**UniqueitemsValidation**](../../models/UniqueitemsValidation.md) | | @@ -11211,9 +10716,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_uniqueitems_validation_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_uniqueitems_validation_request_body.response_for_200.ApiResponse) | success -#### post_uniqueitems_validation_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -11228,8 +10733,6 @@ No authorization required # **post_uniqueitems_validation_response_body_for_content_types** -> UniqueitemsValidation post_uniqueitems_validation_response_body_for_content_types() - ### Example @@ -11237,7 +10740,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import path_post_api -from unit_test_api.model.uniqueitems_validation import UniqueitemsValidation from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -11265,16 +10767,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_uniqueitems_validation_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_uniqueitems_validation_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_uniqueitems_validation_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_uniqueitems_validation_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**UniqueitemsValidation**](../../models/UniqueitemsValidation.md) | | @@ -11288,8 +10790,6 @@ No authorization required # **post_uri_format_request_body** -> post_uri_format_request_body(body) - ### Example @@ -11297,6 +10797,7 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import path_post_api +from unit_test_api.model.uri_format import UriFormat from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -11310,7 +10811,7 @@ with unit_test_api.ApiClient(configuration) as api_client: api_instance = path_post_api.PathPostApi(api_client) # example passing only required values which don't have defaults set - body = None + body = UriFormat(None) try: api_response = api_instance.post_uri_format_request_body( body=body, @@ -11322,29 +10823,28 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_uri_format_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_uri_format_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**UriFormat**](../../models/UriFormat.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, | frozendict.frozendict, str, decimal.Decimal, BoolClass, NoneClass, tuple, bytes, FileIO | | ### Return Types, Responses Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_uri_format_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_uri_format_request_body.response_for_200.ApiResponse) | success -#### post_uri_format_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -11359,8 +10859,6 @@ No authorization required # **post_uri_format_response_body_for_content_types** -> bool, date, datetime, dict, float, int, list, str, none_type post_uri_format_response_body_for_content_types() - ### Example @@ -11395,21 +10893,20 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_uri_format_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_uri_format_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_uri_format_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_uri_format_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**UriFormat**](../../models/UriFormat.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, | frozendict.frozendict, str, decimal.Decimal, BoolClass, NoneClass, tuple, bytes, FileIO | | ### Authorization @@ -11419,8 +10916,6 @@ No authorization required # **post_uri_reference_format_request_body** -> post_uri_reference_format_request_body(body) - ### Example @@ -11428,6 +10923,7 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import path_post_api +from unit_test_api.model.uri_reference_format import UriReferenceFormat from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -11441,7 +10937,7 @@ with unit_test_api.ApiClient(configuration) as api_client: api_instance = path_post_api.PathPostApi(api_client) # example passing only required values which don't have defaults set - body = None + body = UriReferenceFormat(None) try: api_response = api_instance.post_uri_reference_format_request_body( body=body, @@ -11453,29 +10949,28 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_uri_reference_format_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_uri_reference_format_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**UriReferenceFormat**](../../models/UriReferenceFormat.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, | frozendict.frozendict, str, decimal.Decimal, BoolClass, NoneClass, tuple, bytes, FileIO | | ### Return Types, Responses Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_uri_reference_format_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_uri_reference_format_request_body.response_for_200.ApiResponse) | success -#### post_uri_reference_format_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -11490,8 +10985,6 @@ No authorization required # **post_uri_reference_format_response_body_for_content_types** -> bool, date, datetime, dict, float, int, list, str, none_type post_uri_reference_format_response_body_for_content_types() - ### Example @@ -11526,21 +11019,20 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_uri_reference_format_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_uri_reference_format_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_uri_reference_format_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_uri_reference_format_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**UriReferenceFormat**](../../models/UriReferenceFormat.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, | frozendict.frozendict, str, decimal.Decimal, BoolClass, NoneClass, tuple, bytes, FileIO | | ### Authorization @@ -11550,8 +11042,6 @@ No authorization required # **post_uri_template_format_request_body** -> post_uri_template_format_request_body(body) - ### Example @@ -11559,6 +11049,7 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import path_post_api +from unit_test_api.model.uri_template_format import UriTemplateFormat from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -11572,7 +11063,7 @@ with unit_test_api.ApiClient(configuration) as api_client: api_instance = path_post_api.PathPostApi(api_client) # example passing only required values which don't have defaults set - body = None + body = UriTemplateFormat(None) try: api_response = api_instance.post_uri_template_format_request_body( body=body, @@ -11584,29 +11075,28 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_uri_template_format_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_uri_template_format_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**UriTemplateFormat**](../../models/UriTemplateFormat.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, | frozendict.frozendict, str, decimal.Decimal, BoolClass, NoneClass, tuple, bytes, FileIO | | ### Return Types, Responses Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_uri_template_format_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_uri_template_format_request_body.response_for_200.ApiResponse) | success -#### post_uri_template_format_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -11621,8 +11111,6 @@ No authorization required # **post_uri_template_format_response_body_for_content_types** -> bool, date, datetime, dict, float, int, list, str, none_type post_uri_template_format_response_body_for_content_types() - ### Example @@ -11657,21 +11145,20 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_uri_template_format_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_uri_template_format_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_uri_template_format_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_uri_template_format_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**UriTemplateFormat**](../../models/UriTemplateFormat.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, | frozendict.frozendict, str, decimal.Decimal, BoolClass, NoneClass, tuple, bytes, FileIO | | ### Authorization diff --git a/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/PatternApi.md b/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/PatternApi.md index a6cae4de541..704a207b6ba 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/PatternApi.md +++ b/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/PatternApi.md @@ -12,8 +12,6 @@ Method | HTTP request | Description # **post_pattern_is_not_anchored_request_body** -> post_pattern_is_not_anchored_request_body(body) - ### Example @@ -47,15 +45,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_pattern_is_not_anchored_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_pattern_is_not_anchored_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**PatternIsNotAnchored**](../../models/PatternIsNotAnchored.md) | | @@ -66,9 +64,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_pattern_is_not_anchored_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_pattern_is_not_anchored_request_body.response_for_200.ApiResponse) | success -#### post_pattern_is_not_anchored_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -83,8 +81,6 @@ No authorization required # **post_pattern_is_not_anchored_response_body_for_content_types** -> PatternIsNotAnchored post_pattern_is_not_anchored_response_body_for_content_types() - ### Example @@ -92,7 +88,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import pattern_api -from unit_test_api.model.pattern_is_not_anchored import PatternIsNotAnchored from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -120,16 +115,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_pattern_is_not_anchored_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_pattern_is_not_anchored_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_pattern_is_not_anchored_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_pattern_is_not_anchored_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**PatternIsNotAnchored**](../../models/PatternIsNotAnchored.md) | | @@ -143,8 +138,6 @@ No authorization required # **post_pattern_validation_request_body** -> post_pattern_validation_request_body(body) - ### Example @@ -178,15 +171,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_pattern_validation_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_pattern_validation_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**PatternValidation**](../../models/PatternValidation.md) | | @@ -197,9 +190,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_pattern_validation_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_pattern_validation_request_body.response_for_200.ApiResponse) | success -#### post_pattern_validation_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -214,8 +207,6 @@ No authorization required # **post_pattern_validation_response_body_for_content_types** -> PatternValidation post_pattern_validation_response_body_for_content_types() - ### Example @@ -223,7 +214,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import pattern_api -from unit_test_api.model.pattern_validation import PatternValidation from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -251,16 +241,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_pattern_validation_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_pattern_validation_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_pattern_validation_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_pattern_validation_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**PatternValidation**](../../models/PatternValidation.md) | | diff --git a/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/PropertiesApi.md b/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/PropertiesApi.md index 67c74c2c13f..9d036c56572 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/PropertiesApi.md +++ b/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/PropertiesApi.md @@ -12,8 +12,6 @@ Method | HTTP request | Description # **post_object_properties_validation_request_body** -> post_object_properties_validation_request_body(object_properties_validation) - ### Example @@ -47,15 +45,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_object_properties_validation_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_object_properties_validation_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**ObjectPropertiesValidation**](../../models/ObjectPropertiesValidation.md) | | @@ -66,9 +64,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_object_properties_validation_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_object_properties_validation_request_body.response_for_200.ApiResponse) | success -#### post_object_properties_validation_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -83,8 +81,6 @@ No authorization required # **post_object_properties_validation_response_body_for_content_types** -> ObjectPropertiesValidation post_object_properties_validation_response_body_for_content_types() - ### Example @@ -92,7 +88,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import properties_api -from unit_test_api.model.object_properties_validation import ObjectPropertiesValidation from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -120,16 +115,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_object_properties_validation_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_object_properties_validation_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_object_properties_validation_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_object_properties_validation_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**ObjectPropertiesValidation**](../../models/ObjectPropertiesValidation.md) | | @@ -143,8 +138,6 @@ No authorization required # **post_properties_with_escaped_characters_request_body** -> post_properties_with_escaped_characters_request_body(properties_with_escaped_characters) - ### Example @@ -178,15 +171,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_properties_with_escaped_characters_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_properties_with_escaped_characters_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**PropertiesWithEscapedCharacters**](../../models/PropertiesWithEscapedCharacters.md) | | @@ -197,9 +190,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_properties_with_escaped_characters_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_properties_with_escaped_characters_request_body.response_for_200.ApiResponse) | success -#### post_properties_with_escaped_characters_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -214,8 +207,6 @@ No authorization required # **post_properties_with_escaped_characters_response_body_for_content_types** -> PropertiesWithEscapedCharacters post_properties_with_escaped_characters_response_body_for_content_types() - ### Example @@ -223,7 +214,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import properties_api -from unit_test_api.model.properties_with_escaped_characters import PropertiesWithEscapedCharacters from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -251,16 +241,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_properties_with_escaped_characters_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_properties_with_escaped_characters_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_properties_with_escaped_characters_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_properties_with_escaped_characters_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**PropertiesWithEscapedCharacters**](../../models/PropertiesWithEscapedCharacters.md) | | diff --git a/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/RefApi.md b/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/RefApi.md index 520d9c32307..bf1cdcda6f7 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/RefApi.md +++ b/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/RefApi.md @@ -24,8 +24,6 @@ Method | HTTP request | Description # **post_property_named_ref_that_is_not_a_reference_request_body** -> post_property_named_ref_that_is_not_a_reference_request_body(property_named_ref_that_is_not_a_reference) - ### Example @@ -59,15 +57,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_property_named_ref_that_is_not_a_reference_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_property_named_ref_that_is_not_a_reference_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**PropertyNamedRefThatIsNotAReference**](../../models/PropertyNamedRefThatIsNotAReference.md) | | @@ -78,9 +76,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_property_named_ref_that_is_not_a_reference_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_property_named_ref_that_is_not_a_reference_request_body.response_for_200.ApiResponse) | success -#### post_property_named_ref_that_is_not_a_reference_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -95,8 +93,6 @@ No authorization required # **post_property_named_ref_that_is_not_a_reference_response_body_for_content_types** -> PropertyNamedRefThatIsNotAReference post_property_named_ref_that_is_not_a_reference_response_body_for_content_types() - ### Example @@ -104,7 +100,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import ref_api -from unit_test_api.model.property_named_ref_that_is_not_a_reference import PropertyNamedRefThatIsNotAReference from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -132,16 +127,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_property_named_ref_that_is_not_a_reference_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_property_named_ref_that_is_not_a_reference_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_property_named_ref_that_is_not_a_reference_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_property_named_ref_that_is_not_a_reference_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**PropertyNamedRefThatIsNotAReference**](../../models/PropertyNamedRefThatIsNotAReference.md) | | @@ -155,8 +150,6 @@ No authorization required # **post_ref_in_additionalproperties_request_body** -> post_ref_in_additionalproperties_request_body(ref_in_additionalproperties) - ### Example @@ -192,15 +185,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_ref_in_additionalproperties_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_ref_in_additionalproperties_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**RefInAdditionalproperties**](../../models/RefInAdditionalproperties.md) | | @@ -211,9 +204,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_ref_in_additionalproperties_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_ref_in_additionalproperties_request_body.response_for_200.ApiResponse) | success -#### post_ref_in_additionalproperties_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -228,8 +221,6 @@ No authorization required # **post_ref_in_additionalproperties_response_body_for_content_types** -> RefInAdditionalproperties post_ref_in_additionalproperties_response_body_for_content_types() - ### Example @@ -237,7 +228,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import ref_api -from unit_test_api.model.ref_in_additionalproperties import RefInAdditionalproperties from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -265,16 +255,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_ref_in_additionalproperties_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_ref_in_additionalproperties_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_ref_in_additionalproperties_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_ref_in_additionalproperties_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**RefInAdditionalproperties**](../../models/RefInAdditionalproperties.md) | | @@ -288,8 +278,6 @@ No authorization required # **post_ref_in_allof_request_body** -> post_ref_in_allof_request_body(ref_in_allof) - ### Example @@ -323,15 +311,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_ref_in_allof_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_ref_in_allof_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**RefInAllof**](../../models/RefInAllof.md) | | @@ -342,9 +330,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_ref_in_allof_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_ref_in_allof_request_body.response_for_200.ApiResponse) | success -#### post_ref_in_allof_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -359,8 +347,6 @@ No authorization required # **post_ref_in_allof_response_body_for_content_types** -> RefInAllof post_ref_in_allof_response_body_for_content_types() - ### Example @@ -368,7 +354,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import ref_api -from unit_test_api.model.ref_in_allof import RefInAllof from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -396,16 +381,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_ref_in_allof_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_ref_in_allof_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_ref_in_allof_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_ref_in_allof_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**RefInAllof**](../../models/RefInAllof.md) | | @@ -419,8 +404,6 @@ No authorization required # **post_ref_in_anyof_request_body** -> post_ref_in_anyof_request_body(ref_in_anyof) - ### Example @@ -454,15 +437,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_ref_in_anyof_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_ref_in_anyof_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**RefInAnyof**](../../models/RefInAnyof.md) | | @@ -473,9 +456,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_ref_in_anyof_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_ref_in_anyof_request_body.response_for_200.ApiResponse) | success -#### post_ref_in_anyof_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -490,8 +473,6 @@ No authorization required # **post_ref_in_anyof_response_body_for_content_types** -> RefInAnyof post_ref_in_anyof_response_body_for_content_types() - ### Example @@ -499,7 +480,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import ref_api -from unit_test_api.model.ref_in_anyof import RefInAnyof from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -527,16 +507,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_ref_in_anyof_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_ref_in_anyof_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_ref_in_anyof_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_ref_in_anyof_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**RefInAnyof**](../../models/RefInAnyof.md) | | @@ -550,8 +530,6 @@ No authorization required # **post_ref_in_items_request_body** -> post_ref_in_items_request_body(ref_in_items) - ### Example @@ -587,15 +565,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_ref_in_items_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_ref_in_items_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**RefInItems**](../../models/RefInItems.md) | | @@ -606,9 +584,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_ref_in_items_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_ref_in_items_request_body.response_for_200.ApiResponse) | success -#### post_ref_in_items_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -623,8 +601,6 @@ No authorization required # **post_ref_in_items_response_body_for_content_types** -> RefInItems post_ref_in_items_response_body_for_content_types() - ### Example @@ -632,7 +608,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import ref_api -from unit_test_api.model.ref_in_items import RefInItems from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -660,16 +635,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_ref_in_items_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_ref_in_items_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_ref_in_items_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_ref_in_items_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**RefInItems**](../../models/RefInItems.md) | | @@ -683,8 +658,6 @@ No authorization required # **post_ref_in_not_request_body** -> post_ref_in_not_request_body(body) - ### Example @@ -692,7 +665,7 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import ref_api -from unit_test_api.model.property_named_ref_that_is_not_a_reference import PropertyNamedRefThatIsNotAReference +from unit_test_api.model.ref_in_not import RefInNot from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -706,7 +679,7 @@ with unit_test_api.ApiClient(configuration) as api_client: api_instance = ref_api.RefApi(api_client) # example passing only required values which don't have defaults set - body = None + body = RefInNot(None) try: api_response = api_instance.post_ref_in_not_request_body( body=body, @@ -718,35 +691,28 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_ref_in_not_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_ref_in_not_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body - -# SchemaForRequestBodyApplicationJson +### body -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, | frozendict.frozendict, str, decimal.Decimal, BoolClass, NoneClass, tuple, bytes, FileIO | | +# RequestBody.Schemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**RefInNot**](../../models/RefInNot.md) | | -### Composed Schemas (allOf/anyOf/oneOf/not) -#### not -Class Name | Input Type | Accessed Type | Description | Notes -------------- | ------------- | ------------- | ------------- | ------------- -[PropertyNamedRefThatIsNotAReference]({{complexTypePrefix}}PropertyNamedRefThatIsNotAReference.md) | [**PropertyNamedRefThatIsNotAReference**]({{complexTypePrefix}}PropertyNamedRefThatIsNotAReference.md) | [**PropertyNamedRefThatIsNotAReference**]({{complexTypePrefix}}PropertyNamedRefThatIsNotAReference.md) | | ### Return Types, Responses Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_ref_in_not_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_ref_in_not_request_body.response_for_200.ApiResponse) | success -#### post_ref_in_not_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -761,8 +727,6 @@ No authorization required # **post_ref_in_not_response_body_for_content_types** -> bool, date, datetime, dict, float, int, list, str, none_type post_ref_in_not_response_body_for_content_types() - ### Example @@ -770,7 +734,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import ref_api -from unit_test_api.model.property_named_ref_that_is_not_a_reference import PropertyNamedRefThatIsNotAReference from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -798,27 +761,20 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_ref_in_not_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_ref_in_not_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_ref_in_not_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_ref_in_not_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson - -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, | frozendict.frozendict, str, decimal.Decimal, BoolClass, NoneClass, tuple, bytes, FileIO | | +# response_for_200.BodySchemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**RefInNot**](../../models/RefInNot.md) | | -### Composed Schemas (allOf/anyOf/oneOf/not) -#### not -Class Name | Input Type | Accessed Type | Description | Notes -------------- | ------------- | ------------- | ------------- | ------------- -[PropertyNamedRefThatIsNotAReference]({{complexTypePrefix}}PropertyNamedRefThatIsNotAReference.md) | [**PropertyNamedRefThatIsNotAReference**]({{complexTypePrefix}}PropertyNamedRefThatIsNotAReference.md) | [**PropertyNamedRefThatIsNotAReference**]({{complexTypePrefix}}PropertyNamedRefThatIsNotAReference.md) | | ### Authorization @@ -828,8 +784,6 @@ No authorization required # **post_ref_in_oneof_request_body** -> post_ref_in_oneof_request_body(ref_in_oneof) - ### Example @@ -863,15 +817,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_ref_in_oneof_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_ref_in_oneof_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**RefInOneof**](../../models/RefInOneof.md) | | @@ -882,9 +836,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_ref_in_oneof_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_ref_in_oneof_request_body.response_for_200.ApiResponse) | success -#### post_ref_in_oneof_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -899,8 +853,6 @@ No authorization required # **post_ref_in_oneof_response_body_for_content_types** -> RefInOneof post_ref_in_oneof_response_body_for_content_types() - ### Example @@ -908,7 +860,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import ref_api -from unit_test_api.model.ref_in_oneof import RefInOneof from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -936,16 +887,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_ref_in_oneof_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_ref_in_oneof_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_ref_in_oneof_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_ref_in_oneof_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**RefInOneof**](../../models/RefInOneof.md) | | @@ -959,8 +910,6 @@ No authorization required # **post_ref_in_property_request_body** -> post_ref_in_property_request_body(ref_in_property) - ### Example @@ -994,15 +943,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_ref_in_property_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_ref_in_property_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**RefInProperty**](../../models/RefInProperty.md) | | @@ -1013,9 +962,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_ref_in_property_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_ref_in_property_request_body.response_for_200.ApiResponse) | success -#### post_ref_in_property_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -1030,8 +979,6 @@ No authorization required # **post_ref_in_property_response_body_for_content_types** -> RefInProperty post_ref_in_property_response_body_for_content_types() - ### Example @@ -1039,7 +986,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import ref_api -from unit_test_api.model.ref_in_property import RefInProperty from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -1067,16 +1013,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_ref_in_property_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_ref_in_property_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_ref_in_property_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_ref_in_property_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**RefInProperty**](../../models/RefInProperty.md) | | diff --git a/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/RequiredApi.md b/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/RequiredApi.md index 7ed6e02f04e..47eff4b8c19 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/RequiredApi.md +++ b/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/RequiredApi.md @@ -16,8 +16,6 @@ Method | HTTP request | Description # **post_required_default_validation_request_body** -> post_required_default_validation_request_body(required_default_validation) - ### Example @@ -51,15 +49,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_required_default_validation_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_required_default_validation_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**RequiredDefaultValidation**](../../models/RequiredDefaultValidation.md) | | @@ -70,9 +68,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_required_default_validation_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_required_default_validation_request_body.response_for_200.ApiResponse) | success -#### post_required_default_validation_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -87,8 +85,6 @@ No authorization required # **post_required_default_validation_response_body_for_content_types** -> RequiredDefaultValidation post_required_default_validation_response_body_for_content_types() - ### Example @@ -96,7 +92,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import required_api -from unit_test_api.model.required_default_validation import RequiredDefaultValidation from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -124,16 +119,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_required_default_validation_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_required_default_validation_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_required_default_validation_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_required_default_validation_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**RequiredDefaultValidation**](../../models/RequiredDefaultValidation.md) | | @@ -147,8 +142,6 @@ No authorization required # **post_required_validation_request_body** -> post_required_validation_request_body(required_validation) - ### Example @@ -182,15 +175,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_required_validation_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_required_validation_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**RequiredValidation**](../../models/RequiredValidation.md) | | @@ -201,9 +194,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_required_validation_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_required_validation_request_body.response_for_200.ApiResponse) | success -#### post_required_validation_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -218,8 +211,6 @@ No authorization required # **post_required_validation_response_body_for_content_types** -> RequiredValidation post_required_validation_response_body_for_content_types() - ### Example @@ -227,7 +218,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import required_api -from unit_test_api.model.required_validation import RequiredValidation from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -255,16 +245,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_required_validation_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_required_validation_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_required_validation_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_required_validation_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**RequiredValidation**](../../models/RequiredValidation.md) | | @@ -278,8 +268,6 @@ No authorization required # **post_required_with_empty_array_request_body** -> post_required_with_empty_array_request_body(required_with_empty_array) - ### Example @@ -313,15 +301,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_required_with_empty_array_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_required_with_empty_array_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**RequiredWithEmptyArray**](../../models/RequiredWithEmptyArray.md) | | @@ -332,9 +320,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_required_with_empty_array_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_required_with_empty_array_request_body.response_for_200.ApiResponse) | success -#### post_required_with_empty_array_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -349,8 +337,6 @@ No authorization required # **post_required_with_empty_array_response_body_for_content_types** -> RequiredWithEmptyArray post_required_with_empty_array_response_body_for_content_types() - ### Example @@ -358,7 +344,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import required_api -from unit_test_api.model.required_with_empty_array import RequiredWithEmptyArray from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -386,16 +371,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_required_with_empty_array_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_required_with_empty_array_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_required_with_empty_array_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_required_with_empty_array_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**RequiredWithEmptyArray**](../../models/RequiredWithEmptyArray.md) | | @@ -409,8 +394,6 @@ No authorization required # **post_required_with_escaped_characters_request_body** -> post_required_with_escaped_characters_request_body(body) - ### Example @@ -418,6 +401,7 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import required_api +from unit_test_api.model.required_with_escaped_characters import RequiredWithEscapedCharacters from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -431,7 +415,7 @@ with unit_test_api.ApiClient(configuration) as api_client: api_instance = required_api.RequiredApi(api_client) # example passing only required values which don't have defaults set - body = None + body = RequiredWithEscapedCharacters(None) try: api_response = api_instance.post_required_with_escaped_characters_request_body( body=body, @@ -443,29 +427,28 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_required_with_escaped_characters_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_required_with_escaped_characters_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**RequiredWithEscapedCharacters**](../../models/RequiredWithEscapedCharacters.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, | frozendict.frozendict, str, decimal.Decimal, BoolClass, NoneClass, tuple, bytes, FileIO | | ### Return Types, Responses Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_required_with_escaped_characters_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_required_with_escaped_characters_request_body.response_for_200.ApiResponse) | success -#### post_required_with_escaped_characters_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -480,8 +463,6 @@ No authorization required # **post_required_with_escaped_characters_response_body_for_content_types** -> bool, date, datetime, dict, float, int, list, str, none_type post_required_with_escaped_characters_response_body_for_content_types() - ### Example @@ -516,21 +497,20 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_required_with_escaped_characters_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_required_with_escaped_characters_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_required_with_escaped_characters_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_required_with_escaped_characters_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**RequiredWithEscapedCharacters**](../../models/RequiredWithEscapedCharacters.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, | frozendict.frozendict, str, decimal.Decimal, BoolClass, NoneClass, tuple, bytes, FileIO | | ### Authorization diff --git a/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/ResponseContentContentTypeSchemaApi.md b/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/ResponseContentContentTypeSchemaApi.md index 0147f02e5f6..d1fdf699313 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/ResponseContentContentTypeSchemaApi.md +++ b/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/ResponseContentContentTypeSchemaApi.md @@ -95,8 +95,6 @@ Method | HTTP request | Description # **post_additionalproperties_allows_a_schema_which_should_validate_response_body_for_content_types** -> AdditionalpropertiesAllowsASchemaWhichShouldValidate post_additionalproperties_allows_a_schema_which_should_validate_response_body_for_content_types() - ### Example @@ -104,7 +102,6 @@ Method | HTTP request | Description ```python import unit_test_api from unit_test_api.apis.tags import response_content_content_type_schema_api -from unit_test_api.model.additionalproperties_allows_a_schema_which_should_validate import AdditionalpropertiesAllowsASchemaWhichShouldValidate from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -132,16 +129,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_additionalproperties_allows_a_schema_which_should_validate_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_additionalproperties_allows_a_schema_which_should_validate_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_additionalproperties_allows_a_schema_which_should_validate_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_additionalproperties_allows_a_schema_which_should_validate_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AdditionalpropertiesAllowsASchemaWhichShouldValidate**](../../models/AdditionalpropertiesAllowsASchemaWhichShouldValidate.md) | | @@ -155,8 +152,6 @@ No authorization required # **post_additionalproperties_are_allowed_by_default_response_body_for_content_types** -> AdditionalpropertiesAreAllowedByDefault post_additionalproperties_are_allowed_by_default_response_body_for_content_types() - ### Example @@ -164,7 +159,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import response_content_content_type_schema_api -from unit_test_api.model.additionalproperties_are_allowed_by_default import AdditionalpropertiesAreAllowedByDefault from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -192,16 +186,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_additionalproperties_are_allowed_by_default_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_additionalproperties_are_allowed_by_default_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_additionalproperties_are_allowed_by_default_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_additionalproperties_are_allowed_by_default_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AdditionalpropertiesAreAllowedByDefault**](../../models/AdditionalpropertiesAreAllowedByDefault.md) | | @@ -215,8 +209,6 @@ No authorization required # **post_additionalproperties_can_exist_by_itself_response_body_for_content_types** -> AdditionalpropertiesCanExistByItself post_additionalproperties_can_exist_by_itself_response_body_for_content_types() - ### Example @@ -224,7 +216,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import response_content_content_type_schema_api -from unit_test_api.model.additionalproperties_can_exist_by_itself import AdditionalpropertiesCanExistByItself from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -252,16 +243,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_additionalproperties_can_exist_by_itself_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_additionalproperties_can_exist_by_itself_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_additionalproperties_can_exist_by_itself_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_additionalproperties_can_exist_by_itself_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AdditionalpropertiesCanExistByItself**](../../models/AdditionalpropertiesCanExistByItself.md) | | @@ -275,8 +266,6 @@ No authorization required # **post_additionalproperties_should_not_look_in_applicators_response_body_for_content_types** -> AdditionalpropertiesShouldNotLookInApplicators post_additionalproperties_should_not_look_in_applicators_response_body_for_content_types() - ### Example @@ -284,7 +273,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import response_content_content_type_schema_api -from unit_test_api.model.additionalproperties_should_not_look_in_applicators import AdditionalpropertiesShouldNotLookInApplicators from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -312,16 +300,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_additionalproperties_should_not_look_in_applicators_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_additionalproperties_should_not_look_in_applicators_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_additionalproperties_should_not_look_in_applicators_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_additionalproperties_should_not_look_in_applicators_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AdditionalpropertiesShouldNotLookInApplicators**](../../models/AdditionalpropertiesShouldNotLookInApplicators.md) | | @@ -335,8 +323,6 @@ No authorization required # **post_allof_combined_with_anyof_oneof_response_body_for_content_types** -> AllofCombinedWithAnyofOneof post_allof_combined_with_anyof_oneof_response_body_for_content_types() - ### Example @@ -344,7 +330,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import response_content_content_type_schema_api -from unit_test_api.model.allof_combined_with_anyof_oneof import AllofCombinedWithAnyofOneof from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -372,16 +357,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_allof_combined_with_anyof_oneof_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_allof_combined_with_anyof_oneof_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_allof_combined_with_anyof_oneof_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_allof_combined_with_anyof_oneof_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AllofCombinedWithAnyofOneof**](../../models/AllofCombinedWithAnyofOneof.md) | | @@ -395,8 +380,6 @@ No authorization required # **post_allof_response_body_for_content_types** -> Allof post_allof_response_body_for_content_types() - ### Example @@ -404,7 +387,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import response_content_content_type_schema_api -from unit_test_api.model.allof import Allof from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -432,16 +414,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_allof_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_allof_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_allof_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_allof_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**Allof**](../../models/Allof.md) | | @@ -455,8 +437,6 @@ No authorization required # **post_allof_simple_types_response_body_for_content_types** -> AllofSimpleTypes post_allof_simple_types_response_body_for_content_types() - ### Example @@ -464,7 +444,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import response_content_content_type_schema_api -from unit_test_api.model.allof_simple_types import AllofSimpleTypes from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -492,16 +471,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_allof_simple_types_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_allof_simple_types_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_allof_simple_types_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_allof_simple_types_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AllofSimpleTypes**](../../models/AllofSimpleTypes.md) | | @@ -515,8 +494,6 @@ No authorization required # **post_allof_with_base_schema_response_body_for_content_types** -> AllofWithBaseSchema post_allof_with_base_schema_response_body_for_content_types() - ### Example @@ -524,7 +501,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import response_content_content_type_schema_api -from unit_test_api.model.allof_with_base_schema import AllofWithBaseSchema from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -552,16 +528,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_allof_with_base_schema_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_allof_with_base_schema_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_allof_with_base_schema_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_allof_with_base_schema_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AllofWithBaseSchema**](../../models/AllofWithBaseSchema.md) | | @@ -575,8 +551,6 @@ No authorization required # **post_allof_with_one_empty_schema_response_body_for_content_types** -> AllofWithOneEmptySchema post_allof_with_one_empty_schema_response_body_for_content_types() - ### Example @@ -584,7 +558,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import response_content_content_type_schema_api -from unit_test_api.model.allof_with_one_empty_schema import AllofWithOneEmptySchema from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -612,16 +585,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_allof_with_one_empty_schema_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_allof_with_one_empty_schema_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_allof_with_one_empty_schema_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_allof_with_one_empty_schema_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AllofWithOneEmptySchema**](../../models/AllofWithOneEmptySchema.md) | | @@ -635,8 +608,6 @@ No authorization required # **post_allof_with_the_first_empty_schema_response_body_for_content_types** -> AllofWithTheFirstEmptySchema post_allof_with_the_first_empty_schema_response_body_for_content_types() - ### Example @@ -644,7 +615,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import response_content_content_type_schema_api -from unit_test_api.model.allof_with_the_first_empty_schema import AllofWithTheFirstEmptySchema from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -672,16 +642,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_allof_with_the_first_empty_schema_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_allof_with_the_first_empty_schema_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_allof_with_the_first_empty_schema_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_allof_with_the_first_empty_schema_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AllofWithTheFirstEmptySchema**](../../models/AllofWithTheFirstEmptySchema.md) | | @@ -695,8 +665,6 @@ No authorization required # **post_allof_with_the_last_empty_schema_response_body_for_content_types** -> AllofWithTheLastEmptySchema post_allof_with_the_last_empty_schema_response_body_for_content_types() - ### Example @@ -704,7 +672,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import response_content_content_type_schema_api -from unit_test_api.model.allof_with_the_last_empty_schema import AllofWithTheLastEmptySchema from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -732,16 +699,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_allof_with_the_last_empty_schema_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_allof_with_the_last_empty_schema_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_allof_with_the_last_empty_schema_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_allof_with_the_last_empty_schema_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AllofWithTheLastEmptySchema**](../../models/AllofWithTheLastEmptySchema.md) | | @@ -755,8 +722,6 @@ No authorization required # **post_allof_with_two_empty_schemas_response_body_for_content_types** -> AllofWithTwoEmptySchemas post_allof_with_two_empty_schemas_response_body_for_content_types() - ### Example @@ -764,7 +729,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import response_content_content_type_schema_api -from unit_test_api.model.allof_with_two_empty_schemas import AllofWithTwoEmptySchemas from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -792,16 +756,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_allof_with_two_empty_schemas_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_allof_with_two_empty_schemas_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_allof_with_two_empty_schemas_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_allof_with_two_empty_schemas_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AllofWithTwoEmptySchemas**](../../models/AllofWithTwoEmptySchemas.md) | | @@ -815,8 +779,6 @@ No authorization required # **post_anyof_complex_types_response_body_for_content_types** -> AnyofComplexTypes post_anyof_complex_types_response_body_for_content_types() - ### Example @@ -824,7 +786,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import response_content_content_type_schema_api -from unit_test_api.model.anyof_complex_types import AnyofComplexTypes from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -852,16 +813,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_anyof_complex_types_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_anyof_complex_types_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_anyof_complex_types_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_anyof_complex_types_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AnyofComplexTypes**](../../models/AnyofComplexTypes.md) | | @@ -875,8 +836,6 @@ No authorization required # **post_anyof_response_body_for_content_types** -> Anyof post_anyof_response_body_for_content_types() - ### Example @@ -884,7 +843,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import response_content_content_type_schema_api -from unit_test_api.model.anyof import Anyof from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -912,16 +870,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_anyof_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_anyof_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_anyof_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_anyof_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**Anyof**](../../models/Anyof.md) | | @@ -935,8 +893,6 @@ No authorization required # **post_anyof_with_base_schema_response_body_for_content_types** -> AnyofWithBaseSchema post_anyof_with_base_schema_response_body_for_content_types() - ### Example @@ -944,7 +900,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import response_content_content_type_schema_api -from unit_test_api.model.anyof_with_base_schema import AnyofWithBaseSchema from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -972,16 +927,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_anyof_with_base_schema_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_anyof_with_base_schema_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_anyof_with_base_schema_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_anyof_with_base_schema_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AnyofWithBaseSchema**](../../models/AnyofWithBaseSchema.md) | | @@ -995,8 +950,6 @@ No authorization required # **post_anyof_with_one_empty_schema_response_body_for_content_types** -> AnyofWithOneEmptySchema post_anyof_with_one_empty_schema_response_body_for_content_types() - ### Example @@ -1004,7 +957,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import response_content_content_type_schema_api -from unit_test_api.model.anyof_with_one_empty_schema import AnyofWithOneEmptySchema from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -1032,16 +984,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_anyof_with_one_empty_schema_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_anyof_with_one_empty_schema_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_anyof_with_one_empty_schema_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_anyof_with_one_empty_schema_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AnyofWithOneEmptySchema**](../../models/AnyofWithOneEmptySchema.md) | | @@ -1055,8 +1007,6 @@ No authorization required # **post_array_type_matches_arrays_response_body_for_content_types** -> ArrayTypeMatchesArrays post_array_type_matches_arrays_response_body_for_content_types() - ### Example @@ -1064,7 +1014,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import response_content_content_type_schema_api -from unit_test_api.model.array_type_matches_arrays import ArrayTypeMatchesArrays from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -1092,16 +1041,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_array_type_matches_arrays_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_array_type_matches_arrays_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_array_type_matches_arrays_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_array_type_matches_arrays_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**ArrayTypeMatchesArrays**](../../models/ArrayTypeMatchesArrays.md) | | @@ -1115,8 +1064,6 @@ No authorization required # **post_boolean_type_matches_booleans_response_body_for_content_types** -> bool post_boolean_type_matches_booleans_response_body_for_content_types() - ### Example @@ -1151,21 +1098,20 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_boolean_type_matches_booleans_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_boolean_type_matches_booleans_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_boolean_type_matches_booleans_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_boolean_type_matches_booleans_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**BooleanTypeMatchesBooleans**](../../models/BooleanTypeMatchesBooleans.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -bool, | BoolClass, | | ### Authorization @@ -1175,8 +1121,6 @@ No authorization required # **post_by_int_response_body_for_content_types** -> ByInt post_by_int_response_body_for_content_types() - ### Example @@ -1184,7 +1128,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import response_content_content_type_schema_api -from unit_test_api.model.by_int import ByInt from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -1212,16 +1155,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_by_int_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_by_int_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_by_int_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_by_int_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**ByInt**](../../models/ByInt.md) | | @@ -1235,8 +1178,6 @@ No authorization required # **post_by_number_response_body_for_content_types** -> ByNumber post_by_number_response_body_for_content_types() - ### Example @@ -1244,7 +1185,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import response_content_content_type_schema_api -from unit_test_api.model.by_number import ByNumber from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -1272,16 +1212,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_by_number_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_by_number_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_by_number_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_by_number_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**ByNumber**](../../models/ByNumber.md) | | @@ -1295,8 +1235,6 @@ No authorization required # **post_by_small_number_response_body_for_content_types** -> BySmallNumber post_by_small_number_response_body_for_content_types() - ### Example @@ -1304,7 +1242,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import response_content_content_type_schema_api -from unit_test_api.model.by_small_number import BySmallNumber from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -1332,16 +1269,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_by_small_number_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_by_small_number_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_by_small_number_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_by_small_number_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**BySmallNumber**](../../models/BySmallNumber.md) | | @@ -1355,8 +1292,6 @@ No authorization required # **post_date_time_format_response_body_for_content_types** -> bool, date, datetime, dict, float, int, list, str, none_type post_date_time_format_response_body_for_content_types() - ### Example @@ -1391,21 +1326,20 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_date_time_format_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_date_time_format_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_date_time_format_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_date_time_format_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**DateTimeFormat**](../../models/DateTimeFormat.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, | frozendict.frozendict, str, decimal.Decimal, BoolClass, NoneClass, tuple, bytes, FileIO | | value must conform to RFC-3339 date-time ### Authorization @@ -1415,8 +1349,6 @@ No authorization required # **post_email_format_response_body_for_content_types** -> bool, date, datetime, dict, float, int, list, str, none_type post_email_format_response_body_for_content_types() - ### Example @@ -1451,21 +1383,20 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_email_format_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_email_format_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_email_format_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_email_format_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**EmailFormat**](../../models/EmailFormat.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, | frozendict.frozendict, str, decimal.Decimal, BoolClass, NoneClass, tuple, bytes, FileIO | | ### Authorization @@ -1475,8 +1406,6 @@ No authorization required # **post_enum_with0_does_not_match_false_response_body_for_content_types** -> EnumWith0DoesNotMatchFalse post_enum_with0_does_not_match_false_response_body_for_content_types() - ### Example @@ -1484,7 +1413,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import response_content_content_type_schema_api -from unit_test_api.model.enum_with0_does_not_match_false import EnumWith0DoesNotMatchFalse from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -1512,16 +1440,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_enum_with0_does_not_match_false_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_enum_with0_does_not_match_false_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_enum_with0_does_not_match_false_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_enum_with0_does_not_match_false_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**EnumWith0DoesNotMatchFalse**](../../models/EnumWith0DoesNotMatchFalse.md) | | @@ -1535,8 +1463,6 @@ No authorization required # **post_enum_with1_does_not_match_true_response_body_for_content_types** -> EnumWith1DoesNotMatchTrue post_enum_with1_does_not_match_true_response_body_for_content_types() - ### Example @@ -1544,7 +1470,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import response_content_content_type_schema_api -from unit_test_api.model.enum_with1_does_not_match_true import EnumWith1DoesNotMatchTrue from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -1572,16 +1497,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_enum_with1_does_not_match_true_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_enum_with1_does_not_match_true_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_enum_with1_does_not_match_true_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_enum_with1_does_not_match_true_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**EnumWith1DoesNotMatchTrue**](../../models/EnumWith1DoesNotMatchTrue.md) | | @@ -1595,8 +1520,6 @@ No authorization required # **post_enum_with_escaped_characters_response_body_for_content_types** -> EnumWithEscapedCharacters post_enum_with_escaped_characters_response_body_for_content_types() - ### Example @@ -1604,7 +1527,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import response_content_content_type_schema_api -from unit_test_api.model.enum_with_escaped_characters import EnumWithEscapedCharacters from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -1632,16 +1554,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_enum_with_escaped_characters_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_enum_with_escaped_characters_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_enum_with_escaped_characters_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_enum_with_escaped_characters_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**EnumWithEscapedCharacters**](../../models/EnumWithEscapedCharacters.md) | | @@ -1655,8 +1577,6 @@ No authorization required # **post_enum_with_false_does_not_match0_response_body_for_content_types** -> EnumWithFalseDoesNotMatch0 post_enum_with_false_does_not_match0_response_body_for_content_types() - ### Example @@ -1664,7 +1584,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import response_content_content_type_schema_api -from unit_test_api.model.enum_with_false_does_not_match0 import EnumWithFalseDoesNotMatch0 from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -1692,16 +1611,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_enum_with_false_does_not_match0_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_enum_with_false_does_not_match0_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_enum_with_false_does_not_match0_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_enum_with_false_does_not_match0_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**EnumWithFalseDoesNotMatch0**](../../models/EnumWithFalseDoesNotMatch0.md) | | @@ -1715,8 +1634,6 @@ No authorization required # **post_enum_with_true_does_not_match1_response_body_for_content_types** -> EnumWithTrueDoesNotMatch1 post_enum_with_true_does_not_match1_response_body_for_content_types() - ### Example @@ -1724,7 +1641,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import response_content_content_type_schema_api -from unit_test_api.model.enum_with_true_does_not_match1 import EnumWithTrueDoesNotMatch1 from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -1752,16 +1668,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_enum_with_true_does_not_match1_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_enum_with_true_does_not_match1_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_enum_with_true_does_not_match1_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_enum_with_true_does_not_match1_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**EnumWithTrueDoesNotMatch1**](../../models/EnumWithTrueDoesNotMatch1.md) | | @@ -1775,8 +1691,6 @@ No authorization required # **post_enums_in_properties_response_body_for_content_types** -> EnumsInProperties post_enums_in_properties_response_body_for_content_types() - ### Example @@ -1784,7 +1698,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import response_content_content_type_schema_api -from unit_test_api.model.enums_in_properties import EnumsInProperties from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -1812,16 +1725,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_enums_in_properties_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_enums_in_properties_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_enums_in_properties_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_enums_in_properties_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**EnumsInProperties**](../../models/EnumsInProperties.md) | | @@ -1835,8 +1748,6 @@ No authorization required # **post_forbidden_property_response_body_for_content_types** -> ForbiddenProperty post_forbidden_property_response_body_for_content_types() - ### Example @@ -1844,7 +1755,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import response_content_content_type_schema_api -from unit_test_api.model.forbidden_property import ForbiddenProperty from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -1872,16 +1782,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_forbidden_property_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_forbidden_property_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_forbidden_property_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_forbidden_property_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**ForbiddenProperty**](../../models/ForbiddenProperty.md) | | @@ -1895,8 +1805,6 @@ No authorization required # **post_hostname_format_response_body_for_content_types** -> bool, date, datetime, dict, float, int, list, str, none_type post_hostname_format_response_body_for_content_types() - ### Example @@ -1931,21 +1839,20 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_hostname_format_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_hostname_format_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_hostname_format_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_hostname_format_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**HostnameFormat**](../../models/HostnameFormat.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, | frozendict.frozendict, str, decimal.Decimal, BoolClass, NoneClass, tuple, bytes, FileIO | | ### Authorization @@ -1955,8 +1862,6 @@ No authorization required # **post_integer_type_matches_integers_response_body_for_content_types** -> int post_integer_type_matches_integers_response_body_for_content_types() - ### Example @@ -1991,21 +1896,20 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_integer_type_matches_integers_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_integer_type_matches_integers_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_integer_type_matches_integers_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_integer_type_matches_integers_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**IntegerTypeMatchesIntegers**](../../models/IntegerTypeMatchesIntegers.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -decimal.Decimal, int, | decimal.Decimal, | | ### Authorization @@ -2015,8 +1919,6 @@ No authorization required # **post_invalid_instance_should_not_raise_error_when_float_division_inf_response_body_for_content_types** -> InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf post_invalid_instance_should_not_raise_error_when_float_division_inf_response_body_for_content_types() - ### Example @@ -2024,7 +1926,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import response_content_content_type_schema_api -from unit_test_api.model.invalid_instance_should_not_raise_error_when_float_division_inf import InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -2052,16 +1953,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_invalid_instance_should_not_raise_error_when_float_division_inf_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_invalid_instance_should_not_raise_error_when_float_division_inf_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_invalid_instance_should_not_raise_error_when_float_division_inf_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_invalid_instance_should_not_raise_error_when_float_division_inf_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf**](../../models/InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf.md) | | @@ -2075,8 +1976,6 @@ No authorization required # **post_invalid_string_value_for_default_response_body_for_content_types** -> InvalidStringValueForDefault post_invalid_string_value_for_default_response_body_for_content_types() - ### Example @@ -2084,7 +1983,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import response_content_content_type_schema_api -from unit_test_api.model.invalid_string_value_for_default import InvalidStringValueForDefault from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -2112,16 +2010,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_invalid_string_value_for_default_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_invalid_string_value_for_default_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_invalid_string_value_for_default_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_invalid_string_value_for_default_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**InvalidStringValueForDefault**](../../models/InvalidStringValueForDefault.md) | | @@ -2135,8 +2033,6 @@ No authorization required # **post_ipv4_format_response_body_for_content_types** -> bool, date, datetime, dict, float, int, list, str, none_type post_ipv4_format_response_body_for_content_types() - ### Example @@ -2171,21 +2067,20 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_ipv4_format_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_ipv4_format_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_ipv4_format_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_ipv4_format_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**Ipv4Format**](../../models/Ipv4Format.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, | frozendict.frozendict, str, decimal.Decimal, BoolClass, NoneClass, tuple, bytes, FileIO | | ### Authorization @@ -2195,8 +2090,6 @@ No authorization required # **post_ipv6_format_response_body_for_content_types** -> bool, date, datetime, dict, float, int, list, str, none_type post_ipv6_format_response_body_for_content_types() - ### Example @@ -2231,21 +2124,20 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_ipv6_format_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_ipv6_format_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_ipv6_format_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_ipv6_format_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**Ipv6Format**](../../models/Ipv6Format.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, | frozendict.frozendict, str, decimal.Decimal, BoolClass, NoneClass, tuple, bytes, FileIO | | ### Authorization @@ -2255,8 +2147,6 @@ No authorization required # **post_json_pointer_format_response_body_for_content_types** -> bool, date, datetime, dict, float, int, list, str, none_type post_json_pointer_format_response_body_for_content_types() - ### Example @@ -2291,21 +2181,20 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_json_pointer_format_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_json_pointer_format_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_json_pointer_format_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_json_pointer_format_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**JsonPointerFormat**](../../models/JsonPointerFormat.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, | frozendict.frozendict, str, decimal.Decimal, BoolClass, NoneClass, tuple, bytes, FileIO | | ### Authorization @@ -2315,8 +2204,6 @@ No authorization required # **post_maximum_validation_response_body_for_content_types** -> MaximumValidation post_maximum_validation_response_body_for_content_types() - ### Example @@ -2324,7 +2211,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import response_content_content_type_schema_api -from unit_test_api.model.maximum_validation import MaximumValidation from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -2352,16 +2238,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_maximum_validation_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_maximum_validation_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_maximum_validation_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_maximum_validation_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**MaximumValidation**](../../models/MaximumValidation.md) | | @@ -2375,8 +2261,6 @@ No authorization required # **post_maximum_validation_with_unsigned_integer_response_body_for_content_types** -> MaximumValidationWithUnsignedInteger post_maximum_validation_with_unsigned_integer_response_body_for_content_types() - ### Example @@ -2384,7 +2268,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import response_content_content_type_schema_api -from unit_test_api.model.maximum_validation_with_unsigned_integer import MaximumValidationWithUnsignedInteger from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -2412,16 +2295,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_maximum_validation_with_unsigned_integer_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_maximum_validation_with_unsigned_integer_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_maximum_validation_with_unsigned_integer_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_maximum_validation_with_unsigned_integer_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**MaximumValidationWithUnsignedInteger**](../../models/MaximumValidationWithUnsignedInteger.md) | | @@ -2435,8 +2318,6 @@ No authorization required # **post_maxitems_validation_response_body_for_content_types** -> MaxitemsValidation post_maxitems_validation_response_body_for_content_types() - ### Example @@ -2444,7 +2325,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import response_content_content_type_schema_api -from unit_test_api.model.maxitems_validation import MaxitemsValidation from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -2472,16 +2352,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_maxitems_validation_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_maxitems_validation_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_maxitems_validation_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_maxitems_validation_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**MaxitemsValidation**](../../models/MaxitemsValidation.md) | | @@ -2495,8 +2375,6 @@ No authorization required # **post_maxlength_validation_response_body_for_content_types** -> MaxlengthValidation post_maxlength_validation_response_body_for_content_types() - ### Example @@ -2504,7 +2382,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import response_content_content_type_schema_api -from unit_test_api.model.maxlength_validation import MaxlengthValidation from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -2532,16 +2409,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_maxlength_validation_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_maxlength_validation_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_maxlength_validation_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_maxlength_validation_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**MaxlengthValidation**](../../models/MaxlengthValidation.md) | | @@ -2555,8 +2432,6 @@ No authorization required # **post_maxproperties0_means_the_object_is_empty_response_body_for_content_types** -> Maxproperties0MeansTheObjectIsEmpty post_maxproperties0_means_the_object_is_empty_response_body_for_content_types() - ### Example @@ -2564,7 +2439,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import response_content_content_type_schema_api -from unit_test_api.model.maxproperties0_means_the_object_is_empty import Maxproperties0MeansTheObjectIsEmpty from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -2592,16 +2466,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_maxproperties0_means_the_object_is_empty_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_maxproperties0_means_the_object_is_empty_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_maxproperties0_means_the_object_is_empty_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_maxproperties0_means_the_object_is_empty_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**Maxproperties0MeansTheObjectIsEmpty**](../../models/Maxproperties0MeansTheObjectIsEmpty.md) | | @@ -2615,8 +2489,6 @@ No authorization required # **post_maxproperties_validation_response_body_for_content_types** -> MaxpropertiesValidation post_maxproperties_validation_response_body_for_content_types() - ### Example @@ -2624,7 +2496,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import response_content_content_type_schema_api -from unit_test_api.model.maxproperties_validation import MaxpropertiesValidation from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -2652,16 +2523,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_maxproperties_validation_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_maxproperties_validation_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_maxproperties_validation_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_maxproperties_validation_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**MaxpropertiesValidation**](../../models/MaxpropertiesValidation.md) | | @@ -2675,8 +2546,6 @@ No authorization required # **post_minimum_validation_response_body_for_content_types** -> MinimumValidation post_minimum_validation_response_body_for_content_types() - ### Example @@ -2684,7 +2553,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import response_content_content_type_schema_api -from unit_test_api.model.minimum_validation import MinimumValidation from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -2712,16 +2580,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_minimum_validation_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_minimum_validation_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_minimum_validation_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_minimum_validation_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**MinimumValidation**](../../models/MinimumValidation.md) | | @@ -2735,8 +2603,6 @@ No authorization required # **post_minimum_validation_with_signed_integer_response_body_for_content_types** -> MinimumValidationWithSignedInteger post_minimum_validation_with_signed_integer_response_body_for_content_types() - ### Example @@ -2744,7 +2610,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import response_content_content_type_schema_api -from unit_test_api.model.minimum_validation_with_signed_integer import MinimumValidationWithSignedInteger from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -2772,16 +2637,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_minimum_validation_with_signed_integer_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_minimum_validation_with_signed_integer_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_minimum_validation_with_signed_integer_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_minimum_validation_with_signed_integer_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**MinimumValidationWithSignedInteger**](../../models/MinimumValidationWithSignedInteger.md) | | @@ -2795,8 +2660,6 @@ No authorization required # **post_minitems_validation_response_body_for_content_types** -> MinitemsValidation post_minitems_validation_response_body_for_content_types() - ### Example @@ -2804,7 +2667,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import response_content_content_type_schema_api -from unit_test_api.model.minitems_validation import MinitemsValidation from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -2832,16 +2694,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_minitems_validation_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_minitems_validation_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_minitems_validation_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_minitems_validation_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**MinitemsValidation**](../../models/MinitemsValidation.md) | | @@ -2855,8 +2717,6 @@ No authorization required # **post_minlength_validation_response_body_for_content_types** -> MinlengthValidation post_minlength_validation_response_body_for_content_types() - ### Example @@ -2864,7 +2724,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import response_content_content_type_schema_api -from unit_test_api.model.minlength_validation import MinlengthValidation from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -2892,16 +2751,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_minlength_validation_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_minlength_validation_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_minlength_validation_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_minlength_validation_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**MinlengthValidation**](../../models/MinlengthValidation.md) | | @@ -2915,8 +2774,6 @@ No authorization required # **post_minproperties_validation_response_body_for_content_types** -> MinpropertiesValidation post_minproperties_validation_response_body_for_content_types() - ### Example @@ -2924,7 +2781,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import response_content_content_type_schema_api -from unit_test_api.model.minproperties_validation import MinpropertiesValidation from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -2952,16 +2808,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_minproperties_validation_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_minproperties_validation_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_minproperties_validation_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_minproperties_validation_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**MinpropertiesValidation**](../../models/MinpropertiesValidation.md) | | @@ -2975,8 +2831,6 @@ No authorization required # **post_nested_allof_to_check_validation_semantics_response_body_for_content_types** -> NestedAllofToCheckValidationSemantics post_nested_allof_to_check_validation_semantics_response_body_for_content_types() - ### Example @@ -2984,7 +2838,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import response_content_content_type_schema_api -from unit_test_api.model.nested_allof_to_check_validation_semantics import NestedAllofToCheckValidationSemantics from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -3012,16 +2865,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_nested_allof_to_check_validation_semantics_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_nested_allof_to_check_validation_semantics_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_nested_allof_to_check_validation_semantics_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_nested_allof_to_check_validation_semantics_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**NestedAllofToCheckValidationSemantics**](../../models/NestedAllofToCheckValidationSemantics.md) | | @@ -3035,8 +2888,6 @@ No authorization required # **post_nested_anyof_to_check_validation_semantics_response_body_for_content_types** -> NestedAnyofToCheckValidationSemantics post_nested_anyof_to_check_validation_semantics_response_body_for_content_types() - ### Example @@ -3044,7 +2895,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import response_content_content_type_schema_api -from unit_test_api.model.nested_anyof_to_check_validation_semantics import NestedAnyofToCheckValidationSemantics from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -3072,16 +2922,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_nested_anyof_to_check_validation_semantics_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_nested_anyof_to_check_validation_semantics_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_nested_anyof_to_check_validation_semantics_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_nested_anyof_to_check_validation_semantics_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**NestedAnyofToCheckValidationSemantics**](../../models/NestedAnyofToCheckValidationSemantics.md) | | @@ -3095,8 +2945,6 @@ No authorization required # **post_nested_items_response_body_for_content_types** -> NestedItems post_nested_items_response_body_for_content_types() - ### Example @@ -3104,7 +2952,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import response_content_content_type_schema_api -from unit_test_api.model.nested_items import NestedItems from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -3132,16 +2979,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_nested_items_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_nested_items_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_nested_items_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_nested_items_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**NestedItems**](../../models/NestedItems.md) | | @@ -3155,8 +3002,6 @@ No authorization required # **post_nested_oneof_to_check_validation_semantics_response_body_for_content_types** -> NestedOneofToCheckValidationSemantics post_nested_oneof_to_check_validation_semantics_response_body_for_content_types() - ### Example @@ -3164,7 +3009,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import response_content_content_type_schema_api -from unit_test_api.model.nested_oneof_to_check_validation_semantics import NestedOneofToCheckValidationSemantics from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -3192,16 +3036,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_nested_oneof_to_check_validation_semantics_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_nested_oneof_to_check_validation_semantics_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_nested_oneof_to_check_validation_semantics_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_nested_oneof_to_check_validation_semantics_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**NestedOneofToCheckValidationSemantics**](../../models/NestedOneofToCheckValidationSemantics.md) | | @@ -3215,8 +3059,6 @@ No authorization required # **post_not_more_complex_schema_response_body_for_content_types** -> bool, date, datetime, dict, float, int, list, str, none_type post_not_more_complex_schema_response_body_for_content_types() - ### Example @@ -3251,40 +3093,20 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_not_more_complex_schema_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_not_more_complex_schema_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_not_more_complex_schema_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_not_more_complex_schema_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson - -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, | frozendict.frozendict, str, decimal.Decimal, BoolClass, NoneClass, tuple, bytes, FileIO | | - -### Composed Schemas (allOf/anyOf/oneOf/not) -#### not -Class Name | Input Type | Accessed Type | Description | Notes -------------- | ------------- | ------------- | ------------- | ------------- -[not_schema](#not_schema) | dict, frozendict.frozendict, | frozendict.frozendict, | | - -# not_schema - -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, | frozendict.frozendict, | | +# response_for_200.BodySchemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**NotMoreComplexSchema**](../../models/NotMoreComplexSchema.md) | | -### Dictionary Keys -Key | Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- | ------------- -**foo** | str, | str, | | [optional] -**any_string_name** | dict, frozendict.frozendict, str, date, datetime, int, float, bool, decimal.Decimal, None, list, tuple, bytes, io.FileIO, io.BufferedReader | frozendict.frozendict, str, BoolClass, decimal.Decimal, NoneClass, tuple, bytes, FileIO | any string name can be used but the value must be the correct type | [optional] ### Authorization @@ -3294,8 +3116,6 @@ No authorization required # **post_not_response_body_for_content_types** -> bool, date, datetime, dict, float, int, list, str, none_type post_not_response_body_for_content_types() - ### Example @@ -3330,34 +3150,20 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_not_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_not_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_not_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_not_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson - -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, | frozendict.frozendict, str, decimal.Decimal, BoolClass, NoneClass, tuple, bytes, FileIO | | - -### Composed Schemas (allOf/anyOf/oneOf/not) -#### not -Class Name | Input Type | Accessed Type | Description | Notes -------------- | ------------- | ------------- | ------------- | ------------- -[not_schema](#not_schema) | decimal.Decimal, int, | decimal.Decimal, | | - -# not_schema +# response_for_200.BodySchemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**ModelNot**](../../models/ModelNot.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -decimal.Decimal, int, | decimal.Decimal, | | ### Authorization @@ -3367,8 +3173,6 @@ No authorization required # **post_nul_characters_in_strings_response_body_for_content_types** -> NulCharactersInStrings post_nul_characters_in_strings_response_body_for_content_types() - ### Example @@ -3376,7 +3180,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import response_content_content_type_schema_api -from unit_test_api.model.nul_characters_in_strings import NulCharactersInStrings from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -3404,16 +3207,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_nul_characters_in_strings_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_nul_characters_in_strings_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_nul_characters_in_strings_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_nul_characters_in_strings_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**NulCharactersInStrings**](../../models/NulCharactersInStrings.md) | | @@ -3427,8 +3230,6 @@ No authorization required # **post_null_type_matches_only_the_null_object_response_body_for_content_types** -> none_type post_null_type_matches_only_the_null_object_response_body_for_content_types() - ### Example @@ -3463,21 +3264,20 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_null_type_matches_only_the_null_object_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_null_type_matches_only_the_null_object_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_null_type_matches_only_the_null_object_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_null_type_matches_only_the_null_object_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**NullTypeMatchesOnlyTheNullObject**](../../models/NullTypeMatchesOnlyTheNullObject.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -None, | NoneClass, | | ### Authorization @@ -3487,8 +3287,6 @@ No authorization required # **post_number_type_matches_numbers_response_body_for_content_types** -> int, float post_number_type_matches_numbers_response_body_for_content_types() - ### Example @@ -3523,21 +3321,20 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_number_type_matches_numbers_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_number_type_matches_numbers_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_number_type_matches_numbers_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_number_type_matches_numbers_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**NumberTypeMatchesNumbers**](../../models/NumberTypeMatchesNumbers.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -decimal.Decimal, int, float, | decimal.Decimal, | | ### Authorization @@ -3547,8 +3344,6 @@ No authorization required # **post_object_properties_validation_response_body_for_content_types** -> ObjectPropertiesValidation post_object_properties_validation_response_body_for_content_types() - ### Example @@ -3556,7 +3351,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import response_content_content_type_schema_api -from unit_test_api.model.object_properties_validation import ObjectPropertiesValidation from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -3584,16 +3378,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_object_properties_validation_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_object_properties_validation_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_object_properties_validation_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_object_properties_validation_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**ObjectPropertiesValidation**](../../models/ObjectPropertiesValidation.md) | | @@ -3607,8 +3401,6 @@ No authorization required # **post_object_type_matches_objects_response_body_for_content_types** -> {str: (bool, date, datetime, dict, float, int, list, str, none_type)} post_object_type_matches_objects_response_body_for_content_types() - ### Example @@ -3643,21 +3435,20 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_object_type_matches_objects_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_object_type_matches_objects_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_object_type_matches_objects_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_object_type_matches_objects_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**ObjectTypeMatchesObjects**](../../models/ObjectTypeMatchesObjects.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, | frozendict.frozendict, | | ### Authorization @@ -3667,8 +3458,6 @@ No authorization required # **post_oneof_complex_types_response_body_for_content_types** -> OneofComplexTypes post_oneof_complex_types_response_body_for_content_types() - ### Example @@ -3676,7 +3465,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import response_content_content_type_schema_api -from unit_test_api.model.oneof_complex_types import OneofComplexTypes from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -3704,16 +3492,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_oneof_complex_types_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_oneof_complex_types_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_oneof_complex_types_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_oneof_complex_types_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**OneofComplexTypes**](../../models/OneofComplexTypes.md) | | @@ -3727,8 +3515,6 @@ No authorization required # **post_oneof_response_body_for_content_types** -> Oneof post_oneof_response_body_for_content_types() - ### Example @@ -3736,7 +3522,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import response_content_content_type_schema_api -from unit_test_api.model.oneof import Oneof from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -3764,16 +3549,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_oneof_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_oneof_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_oneof_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_oneof_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**Oneof**](../../models/Oneof.md) | | @@ -3787,8 +3572,6 @@ No authorization required # **post_oneof_with_base_schema_response_body_for_content_types** -> OneofWithBaseSchema post_oneof_with_base_schema_response_body_for_content_types() - ### Example @@ -3796,7 +3579,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import response_content_content_type_schema_api -from unit_test_api.model.oneof_with_base_schema import OneofWithBaseSchema from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -3824,16 +3606,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_oneof_with_base_schema_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_oneof_with_base_schema_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_oneof_with_base_schema_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_oneof_with_base_schema_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**OneofWithBaseSchema**](../../models/OneofWithBaseSchema.md) | | @@ -3847,8 +3629,6 @@ No authorization required # **post_oneof_with_empty_schema_response_body_for_content_types** -> OneofWithEmptySchema post_oneof_with_empty_schema_response_body_for_content_types() - ### Example @@ -3856,7 +3636,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import response_content_content_type_schema_api -from unit_test_api.model.oneof_with_empty_schema import OneofWithEmptySchema from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -3884,16 +3663,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_oneof_with_empty_schema_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_oneof_with_empty_schema_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_oneof_with_empty_schema_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_oneof_with_empty_schema_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**OneofWithEmptySchema**](../../models/OneofWithEmptySchema.md) | | @@ -3907,8 +3686,6 @@ No authorization required # **post_oneof_with_required_response_body_for_content_types** -> OneofWithRequired post_oneof_with_required_response_body_for_content_types() - ### Example @@ -3916,7 +3693,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import response_content_content_type_schema_api -from unit_test_api.model.oneof_with_required import OneofWithRequired from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -3944,16 +3720,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_oneof_with_required_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_oneof_with_required_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_oneof_with_required_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_oneof_with_required_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**OneofWithRequired**](../../models/OneofWithRequired.md) | | @@ -3967,8 +3743,6 @@ No authorization required # **post_pattern_is_not_anchored_response_body_for_content_types** -> PatternIsNotAnchored post_pattern_is_not_anchored_response_body_for_content_types() - ### Example @@ -3976,7 +3750,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import response_content_content_type_schema_api -from unit_test_api.model.pattern_is_not_anchored import PatternIsNotAnchored from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -4004,16 +3777,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_pattern_is_not_anchored_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_pattern_is_not_anchored_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_pattern_is_not_anchored_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_pattern_is_not_anchored_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**PatternIsNotAnchored**](../../models/PatternIsNotAnchored.md) | | @@ -4027,8 +3800,6 @@ No authorization required # **post_pattern_validation_response_body_for_content_types** -> PatternValidation post_pattern_validation_response_body_for_content_types() - ### Example @@ -4036,7 +3807,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import response_content_content_type_schema_api -from unit_test_api.model.pattern_validation import PatternValidation from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -4064,16 +3834,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_pattern_validation_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_pattern_validation_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_pattern_validation_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_pattern_validation_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**PatternValidation**](../../models/PatternValidation.md) | | @@ -4087,8 +3857,6 @@ No authorization required # **post_properties_with_escaped_characters_response_body_for_content_types** -> PropertiesWithEscapedCharacters post_properties_with_escaped_characters_response_body_for_content_types() - ### Example @@ -4096,7 +3864,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import response_content_content_type_schema_api -from unit_test_api.model.properties_with_escaped_characters import PropertiesWithEscapedCharacters from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -4124,16 +3891,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_properties_with_escaped_characters_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_properties_with_escaped_characters_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_properties_with_escaped_characters_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_properties_with_escaped_characters_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**PropertiesWithEscapedCharacters**](../../models/PropertiesWithEscapedCharacters.md) | | @@ -4147,8 +3914,6 @@ No authorization required # **post_property_named_ref_that_is_not_a_reference_response_body_for_content_types** -> PropertyNamedRefThatIsNotAReference post_property_named_ref_that_is_not_a_reference_response_body_for_content_types() - ### Example @@ -4156,7 +3921,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import response_content_content_type_schema_api -from unit_test_api.model.property_named_ref_that_is_not_a_reference import PropertyNamedRefThatIsNotAReference from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -4184,16 +3948,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_property_named_ref_that_is_not_a_reference_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_property_named_ref_that_is_not_a_reference_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_property_named_ref_that_is_not_a_reference_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_property_named_ref_that_is_not_a_reference_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**PropertyNamedRefThatIsNotAReference**](../../models/PropertyNamedRefThatIsNotAReference.md) | | @@ -4207,8 +3971,6 @@ No authorization required # **post_ref_in_additionalproperties_response_body_for_content_types** -> RefInAdditionalproperties post_ref_in_additionalproperties_response_body_for_content_types() - ### Example @@ -4216,7 +3978,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import response_content_content_type_schema_api -from unit_test_api.model.ref_in_additionalproperties import RefInAdditionalproperties from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -4244,16 +4005,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_ref_in_additionalproperties_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_ref_in_additionalproperties_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_ref_in_additionalproperties_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_ref_in_additionalproperties_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**RefInAdditionalproperties**](../../models/RefInAdditionalproperties.md) | | @@ -4267,8 +4028,6 @@ No authorization required # **post_ref_in_allof_response_body_for_content_types** -> RefInAllof post_ref_in_allof_response_body_for_content_types() - ### Example @@ -4276,7 +4035,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import response_content_content_type_schema_api -from unit_test_api.model.ref_in_allof import RefInAllof from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -4304,16 +4062,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_ref_in_allof_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_ref_in_allof_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_ref_in_allof_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_ref_in_allof_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**RefInAllof**](../../models/RefInAllof.md) | | @@ -4327,8 +4085,6 @@ No authorization required # **post_ref_in_anyof_response_body_for_content_types** -> RefInAnyof post_ref_in_anyof_response_body_for_content_types() - ### Example @@ -4336,7 +4092,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import response_content_content_type_schema_api -from unit_test_api.model.ref_in_anyof import RefInAnyof from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -4364,16 +4119,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_ref_in_anyof_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_ref_in_anyof_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_ref_in_anyof_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_ref_in_anyof_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**RefInAnyof**](../../models/RefInAnyof.md) | | @@ -4387,8 +4142,6 @@ No authorization required # **post_ref_in_items_response_body_for_content_types** -> RefInItems post_ref_in_items_response_body_for_content_types() - ### Example @@ -4396,7 +4149,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import response_content_content_type_schema_api -from unit_test_api.model.ref_in_items import RefInItems from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -4424,16 +4176,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_ref_in_items_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_ref_in_items_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_ref_in_items_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_ref_in_items_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**RefInItems**](../../models/RefInItems.md) | | @@ -4447,8 +4199,6 @@ No authorization required # **post_ref_in_not_response_body_for_content_types** -> bool, date, datetime, dict, float, int, list, str, none_type post_ref_in_not_response_body_for_content_types() - ### Example @@ -4456,7 +4206,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import response_content_content_type_schema_api -from unit_test_api.model.property_named_ref_that_is_not_a_reference import PropertyNamedRefThatIsNotAReference from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -4484,27 +4233,20 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_ref_in_not_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_ref_in_not_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_ref_in_not_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_ref_in_not_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson - -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, | frozendict.frozendict, str, decimal.Decimal, BoolClass, NoneClass, tuple, bytes, FileIO | | +# response_for_200.BodySchemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**RefInNot**](../../models/RefInNot.md) | | -### Composed Schemas (allOf/anyOf/oneOf/not) -#### not -Class Name | Input Type | Accessed Type | Description | Notes -------------- | ------------- | ------------- | ------------- | ------------- -[PropertyNamedRefThatIsNotAReference]({{complexTypePrefix}}PropertyNamedRefThatIsNotAReference.md) | [**PropertyNamedRefThatIsNotAReference**]({{complexTypePrefix}}PropertyNamedRefThatIsNotAReference.md) | [**PropertyNamedRefThatIsNotAReference**]({{complexTypePrefix}}PropertyNamedRefThatIsNotAReference.md) | | ### Authorization @@ -4514,8 +4256,6 @@ No authorization required # **post_ref_in_oneof_response_body_for_content_types** -> RefInOneof post_ref_in_oneof_response_body_for_content_types() - ### Example @@ -4523,7 +4263,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import response_content_content_type_schema_api -from unit_test_api.model.ref_in_oneof import RefInOneof from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -4551,16 +4290,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_ref_in_oneof_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_ref_in_oneof_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_ref_in_oneof_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_ref_in_oneof_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**RefInOneof**](../../models/RefInOneof.md) | | @@ -4574,8 +4313,6 @@ No authorization required # **post_ref_in_property_response_body_for_content_types** -> RefInProperty post_ref_in_property_response_body_for_content_types() - ### Example @@ -4583,7 +4320,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import response_content_content_type_schema_api -from unit_test_api.model.ref_in_property import RefInProperty from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -4611,16 +4347,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_ref_in_property_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_ref_in_property_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_ref_in_property_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_ref_in_property_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**RefInProperty**](../../models/RefInProperty.md) | | @@ -4634,8 +4370,6 @@ No authorization required # **post_required_default_validation_response_body_for_content_types** -> RequiredDefaultValidation post_required_default_validation_response_body_for_content_types() - ### Example @@ -4643,7 +4377,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import response_content_content_type_schema_api -from unit_test_api.model.required_default_validation import RequiredDefaultValidation from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -4671,16 +4404,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_required_default_validation_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_required_default_validation_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_required_default_validation_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_required_default_validation_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**RequiredDefaultValidation**](../../models/RequiredDefaultValidation.md) | | @@ -4694,8 +4427,6 @@ No authorization required # **post_required_validation_response_body_for_content_types** -> RequiredValidation post_required_validation_response_body_for_content_types() - ### Example @@ -4703,7 +4434,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import response_content_content_type_schema_api -from unit_test_api.model.required_validation import RequiredValidation from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -4731,16 +4461,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_required_validation_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_required_validation_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_required_validation_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_required_validation_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**RequiredValidation**](../../models/RequiredValidation.md) | | @@ -4754,8 +4484,6 @@ No authorization required # **post_required_with_empty_array_response_body_for_content_types** -> RequiredWithEmptyArray post_required_with_empty_array_response_body_for_content_types() - ### Example @@ -4763,7 +4491,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import response_content_content_type_schema_api -from unit_test_api.model.required_with_empty_array import RequiredWithEmptyArray from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -4791,16 +4518,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_required_with_empty_array_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_required_with_empty_array_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_required_with_empty_array_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_required_with_empty_array_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**RequiredWithEmptyArray**](../../models/RequiredWithEmptyArray.md) | | @@ -4814,8 +4541,6 @@ No authorization required # **post_required_with_escaped_characters_response_body_for_content_types** -> bool, date, datetime, dict, float, int, list, str, none_type post_required_with_escaped_characters_response_body_for_content_types() - ### Example @@ -4850,21 +4575,20 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_required_with_escaped_characters_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_required_with_escaped_characters_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_required_with_escaped_characters_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_required_with_escaped_characters_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**RequiredWithEscapedCharacters**](../../models/RequiredWithEscapedCharacters.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, | frozendict.frozendict, str, decimal.Decimal, BoolClass, NoneClass, tuple, bytes, FileIO | | ### Authorization @@ -4874,8 +4598,6 @@ No authorization required # **post_simple_enum_validation_response_body_for_content_types** -> SimpleEnumValidation post_simple_enum_validation_response_body_for_content_types() - ### Example @@ -4883,7 +4605,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import response_content_content_type_schema_api -from unit_test_api.model.simple_enum_validation import SimpleEnumValidation from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -4911,16 +4632,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_simple_enum_validation_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_simple_enum_validation_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_simple_enum_validation_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_simple_enum_validation_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**SimpleEnumValidation**](../../models/SimpleEnumValidation.md) | | @@ -4934,8 +4655,6 @@ No authorization required # **post_string_type_matches_strings_response_body_for_content_types** -> str post_string_type_matches_strings_response_body_for_content_types() - ### Example @@ -4970,21 +4689,20 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_string_type_matches_strings_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_string_type_matches_strings_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_string_type_matches_strings_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_string_type_matches_strings_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**StringTypeMatchesStrings**](../../models/StringTypeMatchesStrings.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -str, | str, | | ### Authorization @@ -4994,8 +4712,6 @@ No authorization required # **post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_response_body_for_content_types** -> TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_response_body_for_content_types() - ### Example @@ -5003,7 +4719,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import response_content_content_type_schema_api -from unit_test_api.model.the_default_keyword_does_not_do_anything_if_the_property_is_missing import TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -5031,16 +4746,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing**](../../models/TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.md) | | @@ -5054,8 +4769,6 @@ No authorization required # **post_uniqueitems_false_validation_response_body_for_content_types** -> UniqueitemsFalseValidation post_uniqueitems_false_validation_response_body_for_content_types() - ### Example @@ -5063,7 +4776,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import response_content_content_type_schema_api -from unit_test_api.model.uniqueitems_false_validation import UniqueitemsFalseValidation from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -5091,16 +4803,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_uniqueitems_false_validation_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_uniqueitems_false_validation_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_uniqueitems_false_validation_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_uniqueitems_false_validation_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**UniqueitemsFalseValidation**](../../models/UniqueitemsFalseValidation.md) | | @@ -5114,8 +4826,6 @@ No authorization required # **post_uniqueitems_validation_response_body_for_content_types** -> UniqueitemsValidation post_uniqueitems_validation_response_body_for_content_types() - ### Example @@ -5123,7 +4833,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import response_content_content_type_schema_api -from unit_test_api.model.uniqueitems_validation import UniqueitemsValidation from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -5151,16 +4860,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_uniqueitems_validation_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_uniqueitems_validation_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_uniqueitems_validation_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_uniqueitems_validation_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**UniqueitemsValidation**](../../models/UniqueitemsValidation.md) | | @@ -5174,8 +4883,6 @@ No authorization required # **post_uri_format_response_body_for_content_types** -> bool, date, datetime, dict, float, int, list, str, none_type post_uri_format_response_body_for_content_types() - ### Example @@ -5210,21 +4917,20 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_uri_format_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_uri_format_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_uri_format_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_uri_format_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**UriFormat**](../../models/UriFormat.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, | frozendict.frozendict, str, decimal.Decimal, BoolClass, NoneClass, tuple, bytes, FileIO | | ### Authorization @@ -5234,8 +4940,6 @@ No authorization required # **post_uri_reference_format_response_body_for_content_types** -> bool, date, datetime, dict, float, int, list, str, none_type post_uri_reference_format_response_body_for_content_types() - ### Example @@ -5270,21 +4974,20 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_uri_reference_format_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_uri_reference_format_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_uri_reference_format_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_uri_reference_format_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**UriReferenceFormat**](../../models/UriReferenceFormat.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, | frozendict.frozendict, str, decimal.Decimal, BoolClass, NoneClass, tuple, bytes, FileIO | | ### Authorization @@ -5294,8 +4997,6 @@ No authorization required # **post_uri_template_format_response_body_for_content_types** -> bool, date, datetime, dict, float, int, list, str, none_type post_uri_template_format_response_body_for_content_types() - ### Example @@ -5330,21 +5031,20 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_uri_template_format_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_uri_template_format_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_uri_template_format_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_uri_template_format_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**UriTemplateFormat**](../../models/UriTemplateFormat.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, | frozendict.frozendict, str, decimal.Decimal, BoolClass, NoneClass, tuple, bytes, FileIO | | ### Authorization diff --git a/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/TypeApi.md b/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/TypeApi.md index f3f2d1bebda..011eea04e96 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/TypeApi.md +++ b/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/TypeApi.md @@ -22,8 +22,6 @@ Method | HTTP request | Description # **post_array_type_matches_arrays_request_body** -> post_array_type_matches_arrays_request_body(array_type_matches_arrays) - ### Example @@ -59,15 +57,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_array_type_matches_arrays_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_array_type_matches_arrays_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**ArrayTypeMatchesArrays**](../../models/ArrayTypeMatchesArrays.md) | | @@ -78,9 +76,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_array_type_matches_arrays_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_array_type_matches_arrays_request_body.response_for_200.ApiResponse) | success -#### post_array_type_matches_arrays_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -95,8 +93,6 @@ No authorization required # **post_array_type_matches_arrays_response_body_for_content_types** -> ArrayTypeMatchesArrays post_array_type_matches_arrays_response_body_for_content_types() - ### Example @@ -104,7 +100,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import type_api -from unit_test_api.model.array_type_matches_arrays import ArrayTypeMatchesArrays from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -132,16 +127,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_array_type_matches_arrays_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_array_type_matches_arrays_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_array_type_matches_arrays_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_array_type_matches_arrays_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**ArrayTypeMatchesArrays**](../../models/ArrayTypeMatchesArrays.md) | | @@ -155,8 +150,6 @@ No authorization required # **post_boolean_type_matches_booleans_request_body** -> post_boolean_type_matches_booleans_request_body(body) - ### Example @@ -164,6 +157,7 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import type_api +from unit_test_api.model.boolean_type_matches_booleans import BooleanTypeMatchesBooleans from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -177,7 +171,7 @@ with unit_test_api.ApiClient(configuration) as api_client: api_instance = type_api.TypeApi(api_client) # example passing only required values which don't have defaults set - body = True + body = BooleanTypeMatchesBooleans(True) try: api_response = api_instance.post_boolean_type_matches_booleans_request_body( body=body, @@ -189,29 +183,28 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_boolean_type_matches_booleans_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_boolean_type_matches_booleans_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**BooleanTypeMatchesBooleans**](../../models/BooleanTypeMatchesBooleans.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -bool, | BoolClass, | | ### Return Types, Responses Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_boolean_type_matches_booleans_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_boolean_type_matches_booleans_request_body.response_for_200.ApiResponse) | success -#### post_boolean_type_matches_booleans_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -226,8 +219,6 @@ No authorization required # **post_boolean_type_matches_booleans_response_body_for_content_types** -> bool post_boolean_type_matches_booleans_response_body_for_content_types() - ### Example @@ -262,21 +253,20 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_boolean_type_matches_booleans_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_boolean_type_matches_booleans_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_boolean_type_matches_booleans_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_boolean_type_matches_booleans_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**BooleanTypeMatchesBooleans**](../../models/BooleanTypeMatchesBooleans.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -bool, | BoolClass, | | ### Authorization @@ -286,8 +276,6 @@ No authorization required # **post_integer_type_matches_integers_request_body** -> post_integer_type_matches_integers_request_body(body) - ### Example @@ -295,6 +283,7 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import type_api +from unit_test_api.model.integer_type_matches_integers import IntegerTypeMatchesIntegers from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -308,7 +297,7 @@ with unit_test_api.ApiClient(configuration) as api_client: api_instance = type_api.TypeApi(api_client) # example passing only required values which don't have defaults set - body = 1 + body = IntegerTypeMatchesIntegers(1) try: api_response = api_instance.post_integer_type_matches_integers_request_body( body=body, @@ -320,29 +309,28 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_integer_type_matches_integers_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_integer_type_matches_integers_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**IntegerTypeMatchesIntegers**](../../models/IntegerTypeMatchesIntegers.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -decimal.Decimal, int, | decimal.Decimal, | | ### Return Types, Responses Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_integer_type_matches_integers_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_integer_type_matches_integers_request_body.response_for_200.ApiResponse) | success -#### post_integer_type_matches_integers_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -357,8 +345,6 @@ No authorization required # **post_integer_type_matches_integers_response_body_for_content_types** -> int post_integer_type_matches_integers_response_body_for_content_types() - ### Example @@ -393,21 +379,20 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_integer_type_matches_integers_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_integer_type_matches_integers_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_integer_type_matches_integers_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_integer_type_matches_integers_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**IntegerTypeMatchesIntegers**](../../models/IntegerTypeMatchesIntegers.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -decimal.Decimal, int, | decimal.Decimal, | | ### Authorization @@ -417,8 +402,6 @@ No authorization required # **post_null_type_matches_only_the_null_object_request_body** -> post_null_type_matches_only_the_null_object_request_body(body) - ### Example @@ -426,6 +409,7 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import type_api +from unit_test_api.model.null_type_matches_only_the_null_object import NullTypeMatchesOnlyTheNullObject from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -439,7 +423,7 @@ with unit_test_api.ApiClient(configuration) as api_client: api_instance = type_api.TypeApi(api_client) # example passing only required values which don't have defaults set - body = None + body = NullTypeMatchesOnlyTheNullObject(None) try: api_response = api_instance.post_null_type_matches_only_the_null_object_request_body( body=body, @@ -451,29 +435,28 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_null_type_matches_only_the_null_object_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_null_type_matches_only_the_null_object_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**NullTypeMatchesOnlyTheNullObject**](../../models/NullTypeMatchesOnlyTheNullObject.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -None, | NoneClass, | | ### Return Types, Responses Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_null_type_matches_only_the_null_object_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_null_type_matches_only_the_null_object_request_body.response_for_200.ApiResponse) | success -#### post_null_type_matches_only_the_null_object_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -488,8 +471,6 @@ No authorization required # **post_null_type_matches_only_the_null_object_response_body_for_content_types** -> none_type post_null_type_matches_only_the_null_object_response_body_for_content_types() - ### Example @@ -524,21 +505,20 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_null_type_matches_only_the_null_object_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_null_type_matches_only_the_null_object_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_null_type_matches_only_the_null_object_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_null_type_matches_only_the_null_object_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**NullTypeMatchesOnlyTheNullObject**](../../models/NullTypeMatchesOnlyTheNullObject.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -None, | NoneClass, | | ### Authorization @@ -548,8 +528,6 @@ No authorization required # **post_number_type_matches_numbers_request_body** -> post_number_type_matches_numbers_request_body(body) - ### Example @@ -557,6 +535,7 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import type_api +from unit_test_api.model.number_type_matches_numbers import NumberTypeMatchesNumbers from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -570,7 +549,7 @@ with unit_test_api.ApiClient(configuration) as api_client: api_instance = type_api.TypeApi(api_client) # example passing only required values which don't have defaults set - body = 3.14 + body = NumberTypeMatchesNumbers(3.14) try: api_response = api_instance.post_number_type_matches_numbers_request_body( body=body, @@ -582,29 +561,28 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_number_type_matches_numbers_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_number_type_matches_numbers_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**NumberTypeMatchesNumbers**](../../models/NumberTypeMatchesNumbers.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -decimal.Decimal, int, float, | decimal.Decimal, | | ### Return Types, Responses Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_number_type_matches_numbers_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_number_type_matches_numbers_request_body.response_for_200.ApiResponse) | success -#### post_number_type_matches_numbers_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -619,8 +597,6 @@ No authorization required # **post_number_type_matches_numbers_response_body_for_content_types** -> int, float post_number_type_matches_numbers_response_body_for_content_types() - ### Example @@ -655,21 +631,20 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_number_type_matches_numbers_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_number_type_matches_numbers_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_number_type_matches_numbers_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_number_type_matches_numbers_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**NumberTypeMatchesNumbers**](../../models/NumberTypeMatchesNumbers.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -decimal.Decimal, int, float, | decimal.Decimal, | | ### Authorization @@ -679,8 +654,6 @@ No authorization required # **post_object_type_matches_objects_request_body** -> post_object_type_matches_objects_request_body(body) - ### Example @@ -688,6 +661,7 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import type_api +from unit_test_api.model.object_type_matches_objects import ObjectTypeMatchesObjects from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -701,7 +675,7 @@ with unit_test_api.ApiClient(configuration) as api_client: api_instance = type_api.TypeApi(api_client) # example passing only required values which don't have defaults set - body = dict() + body = ObjectTypeMatchesObjects() try: api_response = api_instance.post_object_type_matches_objects_request_body( body=body, @@ -713,29 +687,28 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_object_type_matches_objects_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_object_type_matches_objects_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**ObjectTypeMatchesObjects**](../../models/ObjectTypeMatchesObjects.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, | frozendict.frozendict, | | ### Return Types, Responses Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_object_type_matches_objects_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_object_type_matches_objects_request_body.response_for_200.ApiResponse) | success -#### post_object_type_matches_objects_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -750,8 +723,6 @@ No authorization required # **post_object_type_matches_objects_response_body_for_content_types** -> {str: (bool, date, datetime, dict, float, int, list, str, none_type)} post_object_type_matches_objects_response_body_for_content_types() - ### Example @@ -786,21 +757,20 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_object_type_matches_objects_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_object_type_matches_objects_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_object_type_matches_objects_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_object_type_matches_objects_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**ObjectTypeMatchesObjects**](../../models/ObjectTypeMatchesObjects.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -dict, frozendict.frozendict, | frozendict.frozendict, | | ### Authorization @@ -810,8 +780,6 @@ No authorization required # **post_string_type_matches_strings_request_body** -> post_string_type_matches_strings_request_body(body) - ### Example @@ -819,6 +787,7 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import type_api +from unit_test_api.model.string_type_matches_strings import StringTypeMatchesStrings from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -832,7 +801,7 @@ with unit_test_api.ApiClient(configuration) as api_client: api_instance = type_api.TypeApi(api_client) # example passing only required values which don't have defaults set - body = "body_example" + body = StringTypeMatchesStrings("body_example") try: api_response = api_instance.post_string_type_matches_strings_request_body( body=body, @@ -844,29 +813,28 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_string_type_matches_strings_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_string_type_matches_strings_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**StringTypeMatchesStrings**](../../models/StringTypeMatchesStrings.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -str, | str, | | ### Return Types, Responses Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_string_type_matches_strings_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_string_type_matches_strings_request_body.response_for_200.ApiResponse) | success -#### post_string_type_matches_strings_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -881,8 +849,6 @@ No authorization required # **post_string_type_matches_strings_response_body_for_content_types** -> str post_string_type_matches_strings_response_body_for_content_types() - ### Example @@ -917,21 +883,20 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_string_type_matches_strings_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_string_type_matches_strings_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_string_type_matches_strings_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_string_type_matches_strings_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**StringTypeMatchesStrings**](../../models/StringTypeMatchesStrings.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -str, | str, | | ### Authorization diff --git a/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/UniqueItemsApi.md b/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/UniqueItemsApi.md index 529b69479c7..6eb06bd8079 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/UniqueItemsApi.md +++ b/samples/openapi3/client/3_0_3_unit_test/python/docs/apis/tags/UniqueItemsApi.md @@ -12,8 +12,6 @@ Method | HTTP request | Description # **post_uniqueitems_false_validation_request_body** -> post_uniqueitems_false_validation_request_body(body) - ### Example @@ -47,15 +45,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_uniqueitems_false_validation_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_uniqueitems_false_validation_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**UniqueitemsFalseValidation**](../../models/UniqueitemsFalseValidation.md) | | @@ -66,9 +64,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_uniqueitems_false_validation_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_uniqueitems_false_validation_request_body.response_for_200.ApiResponse) | success -#### post_uniqueitems_false_validation_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -83,8 +81,6 @@ No authorization required # **post_uniqueitems_false_validation_response_body_for_content_types** -> UniqueitemsFalseValidation post_uniqueitems_false_validation_response_body_for_content_types() - ### Example @@ -92,7 +88,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import unique_items_api -from unit_test_api.model.uniqueitems_false_validation import UniqueitemsFalseValidation from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -120,16 +115,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_uniqueitems_false_validation_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_uniqueitems_false_validation_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_uniqueitems_false_validation_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_uniqueitems_false_validation_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**UniqueitemsFalseValidation**](../../models/UniqueitemsFalseValidation.md) | | @@ -143,8 +138,6 @@ No authorization required # **post_uniqueitems_validation_request_body** -> post_uniqueitems_validation_request_body(body) - ### Example @@ -178,15 +171,15 @@ with unit_test_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#post_uniqueitems_validation_request_body.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_uniqueitems_validation_request_body.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**UniqueitemsValidation**](../../models/UniqueitemsValidation.md) | | @@ -197,9 +190,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_uniqueitems_validation_request_body.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_uniqueitems_validation_request_body.response_for_200.ApiResponse) | success -#### post_uniqueitems_validation_request_body.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -214,8 +207,6 @@ No authorization required # **post_uniqueitems_validation_response_body_for_content_types** -> UniqueitemsValidation post_uniqueitems_validation_response_body_for_content_types() - ### Example @@ -223,7 +214,6 @@ No authorization required ```python import unit_test_api from unit_test_api.apis.tags import unique_items_api -from unit_test_api.model.uniqueitems_validation import UniqueitemsValidation from pprint import pprint # Defining the host is optional and defaults to https://someserver.com/v1 # See configuration.py for a list of all supported configuration parameters. @@ -251,16 +241,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_uniqueitems_validation_response_body_for_content_types.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#post_uniqueitems_validation_response_body_for_content_types.response_for_200.ApiResponse) | success -#### post_uniqueitems_validation_response_body_for_content_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#post_uniqueitems_validation_response_body_for_content_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**UniqueitemsValidation**](../../models/UniqueitemsValidation.md) | | diff --git a/samples/openapi3/client/3_0_3_unit_test/python/docs/models/ObjectTypeMatchesObjects.md b/samples/openapi3/client/3_0_3_unit_test/python/docs/models/ObjectTypeMatchesObjects.md new file mode 100644 index 00000000000..7ef7e50f16f --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/docs/models/ObjectTypeMatchesObjects.md @@ -0,0 +1,9 @@ +# unit_test_api.model.object_type_matches_objects.ObjectTypeMatchesObjects + +## Model Type Info +Input Type | Accessed Type | Description | Notes +------------ | ------------- | ------------- | ------------- +dict, frozendict.frozendict, | frozendict.frozendict, | | + +[[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/3_0_3_unit_test/python/test/test_models/test_object_type_matches_objects.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_models/test_object_type_matches_objects.py new file mode 100644 index 00000000000..2a33d925794 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_models/test_object_type_matches_objects.py @@ -0,0 +1,82 @@ +# coding: utf-8 + +""" + openapi 3.0.3 sample spec + + sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501 + + The version of the OpenAPI document: 0.0.1 + Generated by: https://openapi-generator.tech +""" + +import unittest + +import unit_test_api +from unit_test_api.model.object_type_matches_objects import ObjectTypeMatchesObjects +from unit_test_api import configuration + + +class TestObjectTypeMatchesObjects(unittest.TestCase): + """ObjectTypeMatchesObjects unit test stubs""" + _configuration = configuration.Configuration() + + def test_a_float_is_not_an_object_fails(self): + # a float is not an object + with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): + ObjectTypeMatchesObjects.from_openapi_data_oapg( + 1.1, + _configuration=self._configuration + ) + + def test_null_is_not_an_object_fails(self): + # null is not an object + with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): + ObjectTypeMatchesObjects.from_openapi_data_oapg( + None, + _configuration=self._configuration + ) + + def test_an_array_is_not_an_object_fails(self): + # an array is not an object + with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): + ObjectTypeMatchesObjects.from_openapi_data_oapg( + [ + ], + _configuration=self._configuration + ) + + def test_an_object_is_an_object_passes(self): + # an object is an object + ObjectTypeMatchesObjects.from_openapi_data_oapg( + { + }, + _configuration=self._configuration + ) + + def test_a_string_is_not_an_object_fails(self): + # a string is not an object + with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): + ObjectTypeMatchesObjects.from_openapi_data_oapg( + "foo", + _configuration=self._configuration + ) + + def test_an_integer_is_not_an_object_fails(self): + # an integer is not an object + with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): + ObjectTypeMatchesObjects.from_openapi_data_oapg( + 1, + _configuration=self._configuration + ) + + def test_a_boolean_is_not_an_object_fails(self): + # a boolean is not an object + with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): + ObjectTypeMatchesObjects.from_openapi_data_oapg( + True, + _configuration=self._configuration + ) + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_additionalproperties_allows_a_schema_which_should_validate_request_body/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_additionalproperties_allows_a_schema_which_should_validate_request_body/test_post.py index 1ec438f9e0b..ad74ec903f7 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_additionalproperties_allows_a_schema_which_should_validate_request_body/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_additionalproperties_allows_a_schema_which_should_validate_request_body/test_post.py @@ -44,7 +44,7 @@ def test_no_additional_properties_is_valid_passes(self): 1, } ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -82,7 +82,7 @@ def test_an_additional_invalid_property_is_invalid_fails(self): } ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -102,7 +102,7 @@ def test_an_additional_valid_property_is_valid_passes(self): True, } ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_additionalproperties_are_allowed_by_default_request_body/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_additionalproperties_are_allowed_by_default_request_body/test_post.py index 51206546a3e..7189fc2fe0c 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_additionalproperties_are_allowed_by_default_request_body/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_additionalproperties_are_allowed_by_default_request_body/test_post.py @@ -48,7 +48,7 @@ def test_additional_properties_are_allowed_passes(self): True, } ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_additionalproperties_can_exist_by_itself_request_body/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_additionalproperties_can_exist_by_itself_request_body/test_post.py index 6ef684d7aaa..ac53aabc5ac 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_additionalproperties_can_exist_by_itself_request_body/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_additionalproperties_can_exist_by_itself_request_body/test_post.py @@ -45,7 +45,7 @@ def test_an_additional_invalid_property_is_invalid_fails(self): } ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -61,7 +61,7 @@ def test_an_additional_valid_property_is_valid_passes(self): True, } ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_additionalproperties_should_not_look_in_applicators_request_body/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_additionalproperties_should_not_look_in_applicators_request_body/test_post.py index b8eadc2525f..e38f12a3739 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_additionalproperties_should_not_look_in_applicators_request_body/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_additionalproperties_should_not_look_in_applicators_request_body/test_post.py @@ -47,7 +47,7 @@ def test_properties_defined_in_allof_are_not_examined_fails(self): } ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -65,7 +65,7 @@ def test_valid_test_case_passes(self): True, } ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_allof_combined_with_anyof_oneof_request_body/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_allof_combined_with_anyof_oneof_request_body/test_post.py index d1c7dc21251..dc3ce0eaa17 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_allof_combined_with_anyof_oneof_request_body/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_allof_combined_with_anyof_oneof_request_body/test_post.py @@ -42,7 +42,7 @@ def test_allof_true_anyof_false_oneof_false_fails(self): 2 ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -56,7 +56,7 @@ def test_allof_false_anyof_false_oneof_true_fails(self): 5 ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -70,7 +70,7 @@ def test_allof_false_anyof_true_oneof_true_fails(self): 15 ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -84,7 +84,7 @@ def test_allof_true_anyof_true_oneof_false_fails(self): 6 ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -97,7 +97,7 @@ def test_allof_true_anyof_true_oneof_true_passes(self): payload = ( 30 ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -128,7 +128,7 @@ def test_allof_true_anyof_false_oneof_true_fails(self): 10 ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -142,7 +142,7 @@ def test_allof_false_anyof_true_oneof_false_fails(self): 3 ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -156,7 +156,7 @@ def test_allof_false_anyof_false_oneof_false_fails(self): 1 ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_allof_request_body/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_allof_request_body/test_post.py index b5b226da396..470f2b91d12 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_allof_request_body/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_allof_request_body/test_post.py @@ -46,7 +46,7 @@ def test_allof_passes(self): 2, } ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -80,7 +80,7 @@ def test_mismatch_first_fails(self): } ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -97,7 +97,7 @@ def test_mismatch_second_fails(self): } ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -116,7 +116,7 @@ def test_wrong_type_fails(self): } ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_allof_simple_types_request_body/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_allof_simple_types_request_body/test_post.py index 9bc320bd602..d3e5d6942d1 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_allof_simple_types_request_body/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_allof_simple_types_request_body/test_post.py @@ -41,7 +41,7 @@ def test_valid_passes(self): payload = ( 25 ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -72,7 +72,7 @@ def test_mismatch_one_fails(self): 35 ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_allof_with_base_schema_request_body/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_allof_with_base_schema_request_body/test_post.py index b9cbf295229..bd973cba638 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_allof_with_base_schema_request_body/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_allof_with_base_schema_request_body/test_post.py @@ -48,7 +48,7 @@ def test_valid_passes(self): None, } ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -84,7 +84,7 @@ def test_mismatch_first_allof_fails(self): } ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -103,7 +103,7 @@ def test_mismatch_base_schema_fails(self): } ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -120,7 +120,7 @@ def test_mismatch_both_fails(self): } ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -139,7 +139,7 @@ def test_mismatch_second_allof_fails(self): } ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_allof_with_one_empty_schema_request_body/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_allof_with_one_empty_schema_request_body/test_post.py index 908bd1ca7ba..5bd16a4a057 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_allof_with_one_empty_schema_request_body/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_allof_with_one_empty_schema_request_body/test_post.py @@ -41,7 +41,7 @@ def test_any_data_is_valid_passes(self): payload = ( 1 ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_allof_with_the_first_empty_schema_request_body/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_allof_with_the_first_empty_schema_request_body/test_post.py index 72bd0bed2be..90e74923916 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_allof_with_the_first_empty_schema_request_body/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_allof_with_the_first_empty_schema_request_body/test_post.py @@ -42,7 +42,7 @@ def test_string_is_invalid_fails(self): "foo" ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -55,7 +55,7 @@ def test_number_is_valid_passes(self): payload = ( 1 ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_allof_with_the_last_empty_schema_request_body/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_allof_with_the_last_empty_schema_request_body/test_post.py index 46ab77081dc..f68dc101f6e 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_allof_with_the_last_empty_schema_request_body/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_allof_with_the_last_empty_schema_request_body/test_post.py @@ -42,7 +42,7 @@ def test_string_is_invalid_fails(self): "foo" ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -55,7 +55,7 @@ def test_number_is_valid_passes(self): payload = ( 1 ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_allof_with_two_empty_schemas_request_body/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_allof_with_two_empty_schemas_request_body/test_post.py index 7457f418182..131a0c613d8 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_allof_with_two_empty_schemas_request_body/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_allof_with_two_empty_schemas_request_body/test_post.py @@ -41,7 +41,7 @@ def test_any_data_is_valid_passes(self): payload = ( 1 ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_anyof_complex_types_request_body/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_anyof_complex_types_request_body/test_post.py index 2cd85be49f7..259be224575 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_anyof_complex_types_request_body/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_anyof_complex_types_request_body/test_post.py @@ -44,7 +44,7 @@ def test_second_anyof_valid_complex_passes(self): "baz", } ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -80,7 +80,7 @@ def test_neither_anyof_valid_complex_fails(self): } ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -98,7 +98,7 @@ def test_both_anyof_valid_complex_passes(self): 2, } ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -131,7 +131,7 @@ def test_first_anyof_valid_complex_passes(self): 2, } ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_anyof_request_body/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_anyof_request_body/test_post.py index 8405d6e3181..77955591754 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_anyof_request_body/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_anyof_request_body/test_post.py @@ -41,7 +41,7 @@ def test_second_anyof_valid_passes(self): payload = ( 2.5 ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -72,7 +72,7 @@ def test_neither_anyof_valid_fails(self): 1.5 ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -85,7 +85,7 @@ def test_both_anyof_valid_passes(self): payload = ( 3 ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -115,7 +115,7 @@ def test_first_anyof_valid_passes(self): payload = ( 1 ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_anyof_with_base_schema_request_body/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_anyof_with_base_schema_request_body/test_post.py index 7db203a0e1c..24c03599c1a 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_anyof_with_base_schema_request_body/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_anyof_with_base_schema_request_body/test_post.py @@ -41,7 +41,7 @@ def test_one_anyof_valid_passes(self): payload = ( "foobar" ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -72,7 +72,7 @@ def test_both_anyof_invalid_fails(self): "foo" ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -86,7 +86,7 @@ def test_mismatch_base_schema_fails(self): 3 ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_anyof_with_one_empty_schema_request_body/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_anyof_with_one_empty_schema_request_body/test_post.py index 15e0575d87b..ba35a8aa949 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_anyof_with_one_empty_schema_request_body/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_anyof_with_one_empty_schema_request_body/test_post.py @@ -41,7 +41,7 @@ def test_string_is_valid_passes(self): payload = ( "foo" ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -71,7 +71,7 @@ def test_number_is_valid_passes(self): payload = ( 123 ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_array_type_matches_arrays_request_body/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_array_type_matches_arrays_request_body/test_post.py index 6132d9c26bd..f78a6aa0fd7 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_array_type_matches_arrays_request_body/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_array_type_matches_arrays_request_body/test_post.py @@ -42,7 +42,7 @@ def test_a_float_is_not_an_array_fails(self): 1.1 ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -56,7 +56,7 @@ def test_a_boolean_is_not_an_array_fails(self): True ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -70,7 +70,7 @@ def test_null_is_not_an_array_fails(self): None ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -85,7 +85,7 @@ def test_an_object_is_not_an_array_fails(self): } ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -99,7 +99,7 @@ def test_a_string_is_not_an_array_fails(self): "foo" ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -113,7 +113,7 @@ def test_an_array_is_an_array_passes(self): [ ] ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -144,7 +144,7 @@ def test_an_integer_is_not_an_array_fails(self): 1 ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_boolean_type_matches_booleans_request_body/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_boolean_type_matches_booleans_request_body/test_post.py index 3755adac412..56f4ba8aeaf 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_boolean_type_matches_booleans_request_body/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_boolean_type_matches_booleans_request_body/test_post.py @@ -42,7 +42,7 @@ def test_an_empty_string_is_not_a_boolean_fails(self): "" ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -56,7 +56,7 @@ def test_a_float_is_not_a_boolean_fails(self): 1.1 ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -70,7 +70,7 @@ def test_null_is_not_a_boolean_fails(self): None ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -84,7 +84,7 @@ def test_zero_is_not_a_boolean_fails(self): 0 ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -99,7 +99,7 @@ def test_an_array_is_not_a_boolean_fails(self): ] ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -113,7 +113,7 @@ def test_a_string_is_not_a_boolean_fails(self): "foo" ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -126,7 +126,7 @@ def test_false_is_a_boolean_passes(self): payload = ( False ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -157,7 +157,7 @@ def test_an_integer_is_not_a_boolean_fails(self): 1 ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -170,7 +170,7 @@ def test_true_is_a_boolean_passes(self): payload = ( True ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -202,7 +202,7 @@ def test_an_object_is_not_a_boolean_fails(self): } ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_by_int_request_body/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_by_int_request_body/test_post.py index 6792b353533..08dd4ff8f6e 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_by_int_request_body/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_by_int_request_body/test_post.py @@ -42,7 +42,7 @@ def test_int_by_int_fail_fails(self): 7 ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -55,7 +55,7 @@ def test_int_by_int_passes(self): payload = ( 10 ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -85,7 +85,7 @@ def test_ignores_non_numbers_passes(self): payload = ( "foo" ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_by_number_request_body/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_by_number_request_body/test_post.py index 71cf3827359..0d85ce6a66c 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_by_number_request_body/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_by_number_request_body/test_post.py @@ -41,7 +41,7 @@ def test_45_is_multiple_of15_passes(self): payload = ( 4.5 ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -72,7 +72,7 @@ def test_35_is_not_multiple_of15_fails(self): 35 ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -85,7 +85,7 @@ def test_zero_is_multiple_of_anything_passes(self): payload = ( 0 ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_by_small_number_request_body/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_by_small_number_request_body/test_post.py index f16340e5b9b..c1dd83bc858 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_by_small_number_request_body/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_by_small_number_request_body/test_post.py @@ -42,7 +42,7 @@ def test_000751_is_not_multiple_of00001_fails(self): 0.00751 ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -55,7 +55,7 @@ def test_00075_is_multiple_of00001_passes(self): payload = ( 0.0075 ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_date_time_format_request_body/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_date_time_format_request_body/test_post.py index 51f2f2fd429..9fcaa87edb3 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_date_time_format_request_body/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_date_time_format_request_body/test_post.py @@ -42,7 +42,7 @@ def test_all_string_formats_ignore_objects_passes(self): { } ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -72,7 +72,7 @@ def test_all_string_formats_ignore_booleans_passes(self): payload = ( False ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -102,7 +102,7 @@ def test_all_string_formats_ignore_integers_passes(self): payload = ( 12 ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -132,7 +132,7 @@ def test_all_string_formats_ignore_floats_passes(self): payload = ( 13.7 ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -163,7 +163,7 @@ def test_all_string_formats_ignore_arrays_passes(self): [ ] ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -193,7 +193,7 @@ def test_all_string_formats_ignore_nulls_passes(self): payload = ( None ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_email_format_request_body/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_email_format_request_body/test_post.py index 4d1a472e3b4..7879248ff5f 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_email_format_request_body/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_email_format_request_body/test_post.py @@ -42,7 +42,7 @@ def test_all_string_formats_ignore_objects_passes(self): { } ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -72,7 +72,7 @@ def test_all_string_formats_ignore_booleans_passes(self): payload = ( False ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -102,7 +102,7 @@ def test_all_string_formats_ignore_integers_passes(self): payload = ( 12 ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -132,7 +132,7 @@ def test_all_string_formats_ignore_floats_passes(self): payload = ( 13.7 ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -163,7 +163,7 @@ def test_all_string_formats_ignore_arrays_passes(self): [ ] ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -193,7 +193,7 @@ def test_all_string_formats_ignore_nulls_passes(self): payload = ( None ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_enum_with0_does_not_match_false_request_body/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_enum_with0_does_not_match_false_request_body/test_post.py index c58a7e635a9..c6cad639b0a 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_enum_with0_does_not_match_false_request_body/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_enum_with0_does_not_match_false_request_body/test_post.py @@ -41,7 +41,7 @@ def test_integer_zero_is_valid_passes(self): payload = ( 0 ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -71,7 +71,7 @@ def test_float_zero_is_valid_passes(self): payload = ( 0.0 ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -102,7 +102,7 @@ def test_false_is_invalid_fails(self): False ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_enum_with1_does_not_match_true_request_body/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_enum_with1_does_not_match_true_request_body/test_post.py index 837485e2b97..e6ad4a0b7ad 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_enum_with1_does_not_match_true_request_body/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_enum_with1_does_not_match_true_request_body/test_post.py @@ -42,7 +42,7 @@ def test_true_is_invalid_fails(self): True ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -55,7 +55,7 @@ def test_integer_one_is_valid_passes(self): payload = ( 1 ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -85,7 +85,7 @@ def test_float_one_is_valid_passes(self): payload = ( 1.0 ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_enum_with_escaped_characters_request_body/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_enum_with_escaped_characters_request_body/test_post.py index 2aaa5a405ec..ec1d32c744a 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_enum_with_escaped_characters_request_body/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_enum_with_escaped_characters_request_body/test_post.py @@ -41,7 +41,7 @@ def test_member2_is_valid_passes(self): payload = ( "foo\rbar" ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -71,7 +71,7 @@ def test_member1_is_valid_passes(self): payload = ( "foo\nbar" ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -102,7 +102,7 @@ def test_another_string_is_invalid_fails(self): "abc" ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_enum_with_false_does_not_match0_request_body/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_enum_with_false_does_not_match0_request_body/test_post.py index f68456be55e..0193bd9d8ec 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_enum_with_false_does_not_match0_request_body/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_enum_with_false_does_not_match0_request_body/test_post.py @@ -41,7 +41,7 @@ def test_false_is_valid_passes(self): payload = ( False ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -72,7 +72,7 @@ def test_float_zero_is_invalid_fails(self): 0.0 ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -86,7 +86,7 @@ def test_integer_zero_is_invalid_fails(self): 0 ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_enum_with_true_does_not_match1_request_body/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_enum_with_true_does_not_match1_request_body/test_post.py index 36fc116919a..cfbde927ae4 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_enum_with_true_does_not_match1_request_body/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_enum_with_true_does_not_match1_request_body/test_post.py @@ -42,7 +42,7 @@ def test_float_one_is_invalid_fails(self): 1.0 ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -55,7 +55,7 @@ def test_true_is_valid_passes(self): payload = ( True ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -86,7 +86,7 @@ def test_integer_one_is_invalid_fails(self): 1 ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_enums_in_properties_request_body/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_enums_in_properties_request_body/test_post.py index 9244bfd1824..9bd9743a411 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_enums_in_properties_request_body/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_enums_in_properties_request_body/test_post.py @@ -44,7 +44,7 @@ def test_missing_optional_property_is_valid_passes(self): "bar", } ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -80,7 +80,7 @@ def test_wrong_foo_value_fails(self): } ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -98,7 +98,7 @@ def test_both_properties_are_valid_passes(self): "bar", } ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -134,7 +134,7 @@ def test_wrong_bar_value_fails(self): } ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -149,7 +149,7 @@ def test_missing_all_properties_is_invalid_fails(self): } ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -166,7 +166,7 @@ def test_missing_required_property_is_invalid_fails(self): } ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_forbidden_property_request_body/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_forbidden_property_request_body/test_post.py index 38f04c4f878..96607673062 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_forbidden_property_request_body/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_forbidden_property_request_body/test_post.py @@ -47,7 +47,7 @@ def test_property_present_fails(self): } ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -65,7 +65,7 @@ def test_property_absent_passes(self): 2, } ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_hostname_format_request_body/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_hostname_format_request_body/test_post.py index b626fef6e2b..0e06dcab928 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_hostname_format_request_body/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_hostname_format_request_body/test_post.py @@ -42,7 +42,7 @@ def test_all_string_formats_ignore_objects_passes(self): { } ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -72,7 +72,7 @@ def test_all_string_formats_ignore_booleans_passes(self): payload = ( False ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -102,7 +102,7 @@ def test_all_string_formats_ignore_integers_passes(self): payload = ( 12 ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -132,7 +132,7 @@ def test_all_string_formats_ignore_floats_passes(self): payload = ( 13.7 ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -163,7 +163,7 @@ def test_all_string_formats_ignore_arrays_passes(self): [ ] ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -193,7 +193,7 @@ def test_all_string_formats_ignore_nulls_passes(self): payload = ( None ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_integer_type_matches_integers_request_body/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_integer_type_matches_integers_request_body/test_post.py index d30a2776da4..5425cbed897 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_integer_type_matches_integers_request_body/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_integer_type_matches_integers_request_body/test_post.py @@ -43,7 +43,7 @@ def test_an_object_is_not_an_integer_fails(self): } ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -57,7 +57,7 @@ def test_a_string_is_not_an_integer_fails(self): "foo" ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -71,7 +71,7 @@ def test_null_is_not_an_integer_fails(self): None ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -84,7 +84,7 @@ def test_a_float_with_zero_fractional_part_is_an_integer_passes(self): payload = ( 1.0 ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -115,7 +115,7 @@ def test_a_float_is_not_an_integer_fails(self): 1.1 ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -129,7 +129,7 @@ def test_a_boolean_is_not_an_integer_fails(self): True ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -142,7 +142,7 @@ def test_an_integer_is_an_integer_passes(self): payload = ( 1 ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -173,7 +173,7 @@ def test_a_string_is_still_not_an_integer_even_if_it_looks_like_one_fails(self): "1" ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -188,7 +188,7 @@ def test_an_array_is_not_an_integer_fails(self): ] ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_invalid_instance_should_not_raise_error_when_float_division_inf_request_body/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_invalid_instance_should_not_raise_error_when_float_division_inf_request_body/test_post.py index c2ff2adebed..fb51c877c43 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_invalid_instance_should_not_raise_error_when_float_division_inf_request_body/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_invalid_instance_should_not_raise_error_when_float_division_inf_request_body/test_post.py @@ -42,7 +42,7 @@ def test_always_invalid_but_naive_implementations_may_raise_an_overflow_error_fa 1.0E308 ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -55,7 +55,7 @@ def test_valid_integer_with_multipleof_float_passes(self): payload = ( 123456789 ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_invalid_string_value_for_default_request_body/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_invalid_string_value_for_default_request_body/test_post.py index e3d1edeeee4..8919018b2cb 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_invalid_string_value_for_default_request_body/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_invalid_string_value_for_default_request_body/test_post.py @@ -44,7 +44,7 @@ def test_valid_when_property_is_specified_passes(self): "good", } ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -75,7 +75,7 @@ def test_still_valid_when_the_invalid_default_is_used_passes(self): { } ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_ipv4_format_request_body/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_ipv4_format_request_body/test_post.py index 0c7408ba02f..a907801620c 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_ipv4_format_request_body/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_ipv4_format_request_body/test_post.py @@ -42,7 +42,7 @@ def test_all_string_formats_ignore_objects_passes(self): { } ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -72,7 +72,7 @@ def test_all_string_formats_ignore_booleans_passes(self): payload = ( False ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -102,7 +102,7 @@ def test_all_string_formats_ignore_integers_passes(self): payload = ( 12 ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -132,7 +132,7 @@ def test_all_string_formats_ignore_floats_passes(self): payload = ( 13.7 ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -163,7 +163,7 @@ def test_all_string_formats_ignore_arrays_passes(self): [ ] ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -193,7 +193,7 @@ def test_all_string_formats_ignore_nulls_passes(self): payload = ( None ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_ipv6_format_request_body/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_ipv6_format_request_body/test_post.py index 19214ebb3ae..70fc9423063 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_ipv6_format_request_body/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_ipv6_format_request_body/test_post.py @@ -42,7 +42,7 @@ def test_all_string_formats_ignore_objects_passes(self): { } ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -72,7 +72,7 @@ def test_all_string_formats_ignore_booleans_passes(self): payload = ( False ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -102,7 +102,7 @@ def test_all_string_formats_ignore_integers_passes(self): payload = ( 12 ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -132,7 +132,7 @@ def test_all_string_formats_ignore_floats_passes(self): payload = ( 13.7 ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -163,7 +163,7 @@ def test_all_string_formats_ignore_arrays_passes(self): [ ] ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -193,7 +193,7 @@ def test_all_string_formats_ignore_nulls_passes(self): payload = ( None ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_json_pointer_format_request_body/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_json_pointer_format_request_body/test_post.py index ae8f171dd60..098cce34873 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_json_pointer_format_request_body/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_json_pointer_format_request_body/test_post.py @@ -42,7 +42,7 @@ def test_all_string_formats_ignore_objects_passes(self): { } ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -72,7 +72,7 @@ def test_all_string_formats_ignore_booleans_passes(self): payload = ( False ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -102,7 +102,7 @@ def test_all_string_formats_ignore_integers_passes(self): payload = ( 12 ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -132,7 +132,7 @@ def test_all_string_formats_ignore_floats_passes(self): payload = ( 13.7 ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -163,7 +163,7 @@ def test_all_string_formats_ignore_arrays_passes(self): [ ] ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -193,7 +193,7 @@ def test_all_string_formats_ignore_nulls_passes(self): payload = ( None ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_maximum_validation_request_body/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_maximum_validation_request_body/test_post.py index d16fe2926be..3f5537eb1cd 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_maximum_validation_request_body/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_maximum_validation_request_body/test_post.py @@ -41,7 +41,7 @@ def test_below_the_maximum_is_valid_passes(self): payload = ( 2.6 ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -71,7 +71,7 @@ def test_boundary_point_is_valid_passes(self): payload = ( 3.0 ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -102,7 +102,7 @@ def test_above_the_maximum_is_invalid_fails(self): 3.5 ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -115,7 +115,7 @@ def test_ignores_non_numbers_passes(self): payload = ( "x" ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_maximum_validation_with_unsigned_integer_request_body/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_maximum_validation_with_unsigned_integer_request_body/test_post.py index e26b9b2dae7..00a704b49bd 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_maximum_validation_with_unsigned_integer_request_body/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_maximum_validation_with_unsigned_integer_request_body/test_post.py @@ -41,7 +41,7 @@ def test_below_the_maximum_is_invalid_passes(self): payload = ( 299.97 ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -72,7 +72,7 @@ def test_above_the_maximum_is_invalid_fails(self): 300.5 ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -85,7 +85,7 @@ def test_boundary_point_integer_is_valid_passes(self): payload = ( 300 ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -115,7 +115,7 @@ def test_boundary_point_float_is_valid_passes(self): payload = ( 300.0 ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_maxitems_validation_request_body/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_maxitems_validation_request_body/test_post.py index de8c99ca795..83efc6dca0b 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_maxitems_validation_request_body/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_maxitems_validation_request_body/test_post.py @@ -46,7 +46,7 @@ def test_too_long_is_invalid_fails(self): ] ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -59,7 +59,7 @@ def test_ignores_non_arrays_passes(self): payload = ( "foobar" ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -91,7 +91,7 @@ def test_shorter_is_valid_passes(self): 1, ] ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -124,7 +124,7 @@ def test_exact_length_is_valid_passes(self): 2, ] ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_maxlength_validation_request_body/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_maxlength_validation_request_body/test_post.py index 8443176e95f..5f35a76dffd 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_maxlength_validation_request_body/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_maxlength_validation_request_body/test_post.py @@ -42,7 +42,7 @@ def test_too_long_is_invalid_fails(self): "foo" ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -55,7 +55,7 @@ def test_ignores_non_strings_passes(self): payload = ( 100 ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -85,7 +85,7 @@ def test_shorter_is_valid_passes(self): payload = ( "f" ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -115,7 +115,7 @@ def test_two_supplementary_unicode_code_points_is_long_enough_passes(self): payload = ( "💩💩" ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -145,7 +145,7 @@ def test_exact_length_is_valid_passes(self): payload = ( "fo" ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_maxproperties0_means_the_object_is_empty_request_body/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_maxproperties0_means_the_object_is_empty_request_body/test_post.py index 53c93f5ba26..f975c25ed07 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_maxproperties0_means_the_object_is_empty_request_body/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_maxproperties0_means_the_object_is_empty_request_body/test_post.py @@ -42,7 +42,7 @@ def test_no_properties_is_valid_passes(self): { } ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -76,7 +76,7 @@ def test_one_property_is_invalid_fails(self): } ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_maxproperties_validation_request_body/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_maxproperties_validation_request_body/test_post.py index 75849461f66..6dbcd8d21a2 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_maxproperties_validation_request_body/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_maxproperties_validation_request_body/test_post.py @@ -49,7 +49,7 @@ def test_too_long_is_invalid_fails(self): } ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -66,7 +66,7 @@ def test_ignores_arrays_passes(self): 3, ] ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -96,7 +96,7 @@ def test_ignores_other_non_objects_passes(self): payload = ( 12 ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -126,7 +126,7 @@ def test_ignores_strings_passes(self): payload = ( "foobar" ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -159,7 +159,7 @@ def test_shorter_is_valid_passes(self): 1, } ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -194,7 +194,7 @@ def test_exact_length_is_valid_passes(self): 2, } ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_minimum_validation_request_body/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_minimum_validation_request_body/test_post.py index b637e0e80af..4a38f9ac343 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_minimum_validation_request_body/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_minimum_validation_request_body/test_post.py @@ -41,7 +41,7 @@ def test_boundary_point_is_valid_passes(self): payload = ( 1.1 ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -72,7 +72,7 @@ def test_below_the_minimum_is_invalid_fails(self): 0.6 ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -85,7 +85,7 @@ def test_above_the_minimum_is_valid_passes(self): payload = ( 2.6 ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -115,7 +115,7 @@ def test_ignores_non_numbers_passes(self): payload = ( "x" ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_minimum_validation_with_signed_integer_request_body/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_minimum_validation_with_signed_integer_request_body/test_post.py index 37dab1a048d..1c0c51cb3ea 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_minimum_validation_with_signed_integer_request_body/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_minimum_validation_with_signed_integer_request_body/test_post.py @@ -41,7 +41,7 @@ def test_boundary_point_is_valid_passes(self): payload = ( -2 ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -71,7 +71,7 @@ def test_positive_above_the_minimum_is_valid_passes(self): payload = ( 0 ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -102,7 +102,7 @@ def test_int_below_the_minimum_is_invalid_fails(self): -3 ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -116,7 +116,7 @@ def test_float_below_the_minimum_is_invalid_fails(self): -2.0001 ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -129,7 +129,7 @@ def test_boundary_point_with_float_is_valid_passes(self): payload = ( -2.0 ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -159,7 +159,7 @@ def test_negative_above_the_minimum_is_valid_passes(self): payload = ( -1 ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -189,7 +189,7 @@ def test_ignores_non_numbers_passes(self): payload = ( "x" ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_minitems_validation_request_body/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_minitems_validation_request_body/test_post.py index af54b84112b..7588cfe89d6 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_minitems_validation_request_body/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_minitems_validation_request_body/test_post.py @@ -43,7 +43,7 @@ def test_too_short_is_invalid_fails(self): ] ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -56,7 +56,7 @@ def test_ignores_non_arrays_passes(self): payload = ( "" ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -89,7 +89,7 @@ def test_longer_is_valid_passes(self): 2, ] ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -121,7 +121,7 @@ def test_exact_length_is_valid_passes(self): 1, ] ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_minlength_validation_request_body/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_minlength_validation_request_body/test_post.py index 1a1db934bba..079e2d765de 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_minlength_validation_request_body/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_minlength_validation_request_body/test_post.py @@ -42,7 +42,7 @@ def test_too_short_is_invalid_fails(self): "f" ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -56,7 +56,7 @@ def test_one_supplementary_unicode_code_point_is_not_long_enough_fails(self): "💩" ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -69,7 +69,7 @@ def test_longer_is_valid_passes(self): payload = ( "foo" ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -99,7 +99,7 @@ def test_ignores_non_strings_passes(self): payload = ( 1 ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -129,7 +129,7 @@ def test_exact_length_is_valid_passes(self): payload = ( "fo" ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_minproperties_validation_request_body/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_minproperties_validation_request_body/test_post.py index 91341e06d74..3781d2032c8 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_minproperties_validation_request_body/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_minproperties_validation_request_body/test_post.py @@ -42,7 +42,7 @@ def test_ignores_arrays_passes(self): [ ] ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -72,7 +72,7 @@ def test_ignores_other_non_objects_passes(self): payload = ( 12 ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -104,7 +104,7 @@ def test_too_short_is_invalid_fails(self): } ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -117,7 +117,7 @@ def test_ignores_strings_passes(self): payload = ( "" ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -152,7 +152,7 @@ def test_longer_is_valid_passes(self): 2, } ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -185,7 +185,7 @@ def test_exact_length_is_valid_passes(self): 1, } ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_nested_allof_to_check_validation_semantics_request_body/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_nested_allof_to_check_validation_semantics_request_body/test_post.py index 73e992a05f2..e68773d6a24 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_nested_allof_to_check_validation_semantics_request_body/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_nested_allof_to_check_validation_semantics_request_body/test_post.py @@ -42,7 +42,7 @@ def test_anything_non_null_is_invalid_fails(self): 123 ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -55,7 +55,7 @@ def test_null_is_valid_passes(self): payload = ( None ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_nested_anyof_to_check_validation_semantics_request_body/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_nested_anyof_to_check_validation_semantics_request_body/test_post.py index 7951e3c8e8c..ff0db76919e 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_nested_anyof_to_check_validation_semantics_request_body/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_nested_anyof_to_check_validation_semantics_request_body/test_post.py @@ -42,7 +42,7 @@ def test_anything_non_null_is_invalid_fails(self): 123 ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -55,7 +55,7 @@ def test_null_is_valid_passes(self): payload = ( None ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_nested_items_request_body/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_nested_items_request_body/test_post.py index 60874a6b8ae..8be3d9cc4a6 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_nested_items_request_body/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_nested_items_request_body/test_post.py @@ -70,7 +70,7 @@ def test_valid_nested_array_passes(self): ], ] ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -130,7 +130,7 @@ def test_nested_array_with_invalid_type_fails(self): ] ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -167,7 +167,7 @@ def test_not_deep_enough_fails(self): ] ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_nested_oneof_to_check_validation_semantics_request_body/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_nested_oneof_to_check_validation_semantics_request_body/test_post.py index 42a97ddac7b..669faf36fb3 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_nested_oneof_to_check_validation_semantics_request_body/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_nested_oneof_to_check_validation_semantics_request_body/test_post.py @@ -42,7 +42,7 @@ def test_anything_non_null_is_invalid_fails(self): 123 ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -55,7 +55,7 @@ def test_null_is_valid_passes(self): payload = ( None ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_not_more_complex_schema_request_body/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_not_more_complex_schema_request_body/test_post.py index eaacac00ebb..8585b91a525 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_not_more_complex_schema_request_body/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_not_more_complex_schema_request_body/test_post.py @@ -44,7 +44,7 @@ def test_other_match_passes(self): 1, } ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -78,7 +78,7 @@ def test_mismatch_fails(self): } ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -91,7 +91,7 @@ def test_match_passes(self): payload = ( 1 ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_not_request_body/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_not_request_body/test_post.py index c9bd6f3f304..e502a02e359 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_not_request_body/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_not_request_body/test_post.py @@ -41,7 +41,7 @@ def test_allowed_passes(self): payload = ( "foo" ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -72,7 +72,7 @@ def test_disallowed_fails(self): 1 ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_nul_characters_in_strings_request_body/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_nul_characters_in_strings_request_body/test_post.py index 0586243d617..018514f2bbe 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_nul_characters_in_strings_request_body/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_nul_characters_in_strings_request_body/test_post.py @@ -41,7 +41,7 @@ def test_match_string_with_nul_passes(self): payload = ( "hello\x00there" ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -72,7 +72,7 @@ def test_do_not_match_string_lacking_nul_fails(self): "hellothere" ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_null_type_matches_only_the_null_object_request_body/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_null_type_matches_only_the_null_object_request_body/test_post.py index f75a20619fa..1786fb06066 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_null_type_matches_only_the_null_object_request_body/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_null_type_matches_only_the_null_object_request_body/test_post.py @@ -42,7 +42,7 @@ def test_a_float_is_not_null_fails(self): 1.1 ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -57,7 +57,7 @@ def test_an_object_is_not_null_fails(self): } ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -71,7 +71,7 @@ def test_false_is_not_null_fails(self): False ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -85,7 +85,7 @@ def test_an_integer_is_not_null_fails(self): 1 ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -99,7 +99,7 @@ def test_true_is_not_null_fails(self): True ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -113,7 +113,7 @@ def test_zero_is_not_null_fails(self): 0 ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -127,7 +127,7 @@ def test_an_empty_string_is_not_null_fails(self): "" ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -140,7 +140,7 @@ def test_null_is_null_passes(self): payload = ( None ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -172,7 +172,7 @@ def test_an_array_is_not_null_fails(self): ] ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -186,7 +186,7 @@ def test_a_string_is_not_null_fails(self): "foo" ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_number_type_matches_numbers_request_body/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_number_type_matches_numbers_request_body/test_post.py index 70284734ef6..4a9bf790644 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_number_type_matches_numbers_request_body/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_number_type_matches_numbers_request_body/test_post.py @@ -43,7 +43,7 @@ def test_an_array_is_not_a_number_fails(self): ] ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -57,7 +57,7 @@ def test_null_is_not_a_number_fails(self): None ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -72,7 +72,7 @@ def test_an_object_is_not_a_number_fails(self): } ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -86,7 +86,7 @@ def test_a_boolean_is_not_a_number_fails(self): True ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -99,7 +99,7 @@ def test_a_float_is_a_number_passes(self): payload = ( 1.1 ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -130,7 +130,7 @@ def test_a_string_is_still_not_a_number_even_if_it_looks_like_one_fails(self): "1" ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -144,7 +144,7 @@ def test_a_string_is_not_a_number_fails(self): "foo" ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -157,7 +157,7 @@ def test_an_integer_is_a_number_passes(self): payload = ( 1 ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -187,7 +187,7 @@ def test_a_float_with_zero_fractional_part_is_a_number_and_an_integer_passes(sel payload = ( 1.0 ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_object_properties_validation_request_body/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_object_properties_validation_request_body/test_post.py index 67fe785a8e4..08748ca6f2b 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_object_properties_validation_request_body/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_object_properties_validation_request_body/test_post.py @@ -42,7 +42,7 @@ def test_ignores_arrays_passes(self): [ ] ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -72,7 +72,7 @@ def test_ignores_other_non_objects_passes(self): payload = ( 12 ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -109,7 +109,7 @@ def test_one_property_invalid_is_invalid_fails(self): } ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -127,7 +127,7 @@ def test_both_properties_present_and_valid_is_valid_passes(self): "baz", } ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -161,7 +161,7 @@ def test_doesn_t_invalidate_other_properties_passes(self): ], } ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -199,7 +199,7 @@ def test_both_properties_invalid_is_invalid_fails(self): } ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_object_type_matches_objects_request_body/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_object_type_matches_objects_request_body/test_post.py index da5fdf5754b..4a6cc96b8b0 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_object_type_matches_objects_request_body/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_object_type_matches_objects_request_body/test_post.py @@ -42,7 +42,7 @@ def test_a_float_is_not_an_object_fails(self): 1.1 ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -56,7 +56,7 @@ def test_null_is_not_an_object_fails(self): None ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -71,7 +71,7 @@ def test_an_array_is_not_an_object_fails(self): ] ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -85,7 +85,7 @@ def test_an_object_is_an_object_passes(self): { } ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -116,7 +116,7 @@ def test_a_string_is_not_an_object_fails(self): "foo" ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -130,7 +130,7 @@ def test_an_integer_is_not_an_object_fails(self): 1 ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -144,7 +144,7 @@ def test_a_boolean_is_not_an_object_fails(self): True ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_oneof_complex_types_request_body/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_oneof_complex_types_request_body/test_post.py index a786ebf4eb7..a0a9e390010 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_oneof_complex_types_request_body/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_oneof_complex_types_request_body/test_post.py @@ -44,7 +44,7 @@ def test_first_oneof_valid_complex_passes(self): 2, } ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -80,7 +80,7 @@ def test_neither_oneof_valid_complex_fails(self): } ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -99,7 +99,7 @@ def test_both_oneof_valid_complex_fails(self): } ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -115,7 +115,7 @@ def test_second_oneof_valid_complex_passes(self): "baz", } ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_oneof_request_body/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_oneof_request_body/test_post.py index 1b837331c1f..afb1d278735 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_oneof_request_body/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_oneof_request_body/test_post.py @@ -41,7 +41,7 @@ def test_second_oneof_valid_passes(self): payload = ( 2.5 ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -72,7 +72,7 @@ def test_both_oneof_valid_fails(self): 3 ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -85,7 +85,7 @@ def test_first_oneof_valid_passes(self): payload = ( 1 ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -116,7 +116,7 @@ def test_neither_oneof_valid_fails(self): 1.5 ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_oneof_with_base_schema_request_body/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_oneof_with_base_schema_request_body/test_post.py index 57bc715f62d..821ee84b34c 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_oneof_with_base_schema_request_body/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_oneof_with_base_schema_request_body/test_post.py @@ -42,7 +42,7 @@ def test_both_oneof_valid_fails(self): "foo" ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -56,7 +56,7 @@ def test_mismatch_base_schema_fails(self): 3 ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -69,7 +69,7 @@ def test_one_oneof_valid_passes(self): payload = ( "foobar" ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_oneof_with_empty_schema_request_body/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_oneof_with_empty_schema_request_body/test_post.py index 191c9dc3dc2..aada787b71b 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_oneof_with_empty_schema_request_body/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_oneof_with_empty_schema_request_body/test_post.py @@ -42,7 +42,7 @@ def test_both_valid_invalid_fails(self): 123 ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -55,7 +55,7 @@ def test_one_valid_valid_passes(self): payload = ( "foo" ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_oneof_with_required_request_body/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_oneof_with_required_request_body/test_post.py index 6f01d9c6e51..fbb5fdf3d75 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_oneof_with_required_request_body/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_oneof_with_required_request_body/test_post.py @@ -49,7 +49,7 @@ def test_both_valid_invalid_fails(self): } ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -66,7 +66,7 @@ def test_both_invalid_invalid_fails(self): } ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -84,7 +84,7 @@ def test_first_valid_valid_passes(self): 2, } ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -119,7 +119,7 @@ def test_second_valid_valid_passes(self): 3, } ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_pattern_is_not_anchored_request_body/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_pattern_is_not_anchored_request_body/test_post.py index 6ec8ce1d92a..53cff0084b6 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_pattern_is_not_anchored_request_body/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_pattern_is_not_anchored_request_body/test_post.py @@ -41,7 +41,7 @@ def test_matches_a_substring_passes(self): payload = ( "xxaayy" ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_pattern_validation_request_body/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_pattern_validation_request_body/test_post.py index e788bd9e21c..0964aabd571 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_pattern_validation_request_body/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_pattern_validation_request_body/test_post.py @@ -42,7 +42,7 @@ def test_ignores_arrays_passes(self): [ ] ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -73,7 +73,7 @@ def test_ignores_objects_passes(self): { } ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -103,7 +103,7 @@ def test_ignores_null_passes(self): payload = ( None ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -133,7 +133,7 @@ def test_ignores_floats_passes(self): payload = ( 1.0 ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -164,7 +164,7 @@ def test_a_non_matching_pattern_is_invalid_fails(self): "abc" ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -177,7 +177,7 @@ def test_ignores_booleans_passes(self): payload = ( True ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -207,7 +207,7 @@ def test_a_matching_pattern_is_valid_passes(self): payload = ( "aaa" ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -237,7 +237,7 @@ def test_ignores_integers_passes(self): payload = ( 123 ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_properties_with_escaped_characters_request_body/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_properties_with_escaped_characters_request_body/test_post.py index f0ce9cfad28..7cea775bbee 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_properties_with_escaped_characters_request_body/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_properties_with_escaped_characters_request_body/test_post.py @@ -54,7 +54,7 @@ def test_object_with_all_numbers_is_valid_passes(self): 1, } ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -98,7 +98,7 @@ def test_object_with_strings_is_invalid_fails(self): } ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_property_named_ref_that_is_not_a_reference_request_body/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_property_named_ref_that_is_not_a_reference_request_body/test_post.py index 486fa4c5ae7..72cfd4ef59a 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_property_named_ref_that_is_not_a_reference_request_body/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_property_named_ref_that_is_not_a_reference_request_body/test_post.py @@ -44,7 +44,7 @@ def test_property_named_ref_valid_passes(self): "a", } ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -78,7 +78,7 @@ def test_property_named_ref_invalid_fails(self): } ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_ref_in_additionalproperties_request_body/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_ref_in_additionalproperties_request_body/test_post.py index eabe92bd69b..cd677e9cb18 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_ref_in_additionalproperties_request_body/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_ref_in_additionalproperties_request_body/test_post.py @@ -47,7 +47,7 @@ def test_property_named_ref_valid_passes(self): }, } ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -84,7 +84,7 @@ def test_property_named_ref_invalid_fails(self): } ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_ref_in_allof_request_body/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_ref_in_allof_request_body/test_post.py index b7aa28e7bd7..b03e5d18691 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_ref_in_allof_request_body/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_ref_in_allof_request_body/test_post.py @@ -44,7 +44,7 @@ def test_property_named_ref_valid_passes(self): "a", } ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -78,7 +78,7 @@ def test_property_named_ref_invalid_fails(self): } ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_ref_in_anyof_request_body/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_ref_in_anyof_request_body/test_post.py index 517d2427df6..5b8fb1ed591 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_ref_in_anyof_request_body/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_ref_in_anyof_request_body/test_post.py @@ -44,7 +44,7 @@ def test_property_named_ref_valid_passes(self): "a", } ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -78,7 +78,7 @@ def test_property_named_ref_invalid_fails(self): } ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_ref_in_items_request_body/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_ref_in_items_request_body/test_post.py index e32c859fc69..15b78bf86b4 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_ref_in_items_request_body/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_ref_in_items_request_body/test_post.py @@ -46,7 +46,7 @@ def test_property_named_ref_valid_passes(self): }, ] ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -82,7 +82,7 @@ def test_property_named_ref_invalid_fails(self): ] ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_ref_in_not_request_body/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_ref_in_not_request_body/test_post.py index 2285d7c3b43..bd4c35412f6 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_ref_in_not_request_body/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_ref_in_not_request_body/test_post.py @@ -44,7 +44,7 @@ def test_property_named_ref_valid_passes(self): 2, } ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -78,7 +78,7 @@ def test_property_named_ref_invalid_fails(self): } ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_ref_in_oneof_request_body/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_ref_in_oneof_request_body/test_post.py index 7606a57de91..9212b716292 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_ref_in_oneof_request_body/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_ref_in_oneof_request_body/test_post.py @@ -44,7 +44,7 @@ def test_property_named_ref_valid_passes(self): "a", } ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -78,7 +78,7 @@ def test_property_named_ref_invalid_fails(self): } ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_ref_in_property_request_body/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_ref_in_property_request_body/test_post.py index 7f469264453..5a2f5f62273 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_ref_in_property_request_body/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_ref_in_property_request_body/test_post.py @@ -47,7 +47,7 @@ def test_property_named_ref_valid_passes(self): }, } ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -84,7 +84,7 @@ def test_property_named_ref_invalid_fails(self): } ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_required_default_validation_request_body/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_required_default_validation_request_body/test_post.py index 17a9e08c7a3..098e021e57a 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_required_default_validation_request_body/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_required_default_validation_request_body/test_post.py @@ -42,7 +42,7 @@ def test_not_required_by_default_passes(self): { } ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_required_validation_request_body/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_required_validation_request_body/test_post.py index ab17be30229..4fa39334d1e 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_required_validation_request_body/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_required_validation_request_body/test_post.py @@ -42,7 +42,7 @@ def test_ignores_arrays_passes(self): [ ] ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -75,7 +75,7 @@ def test_present_required_property_is_valid_passes(self): 1, } ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -105,7 +105,7 @@ def test_ignores_other_non_objects_passes(self): payload = ( 12 ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -135,7 +135,7 @@ def test_ignores_strings_passes(self): payload = ( "" ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -169,7 +169,7 @@ def test_non_present_required_property_is_invalid_fails(self): } ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_required_with_empty_array_request_body/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_required_with_empty_array_request_body/test_post.py index 3e3491d1821..e9ded363e78 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_required_with_empty_array_request_body/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_required_with_empty_array_request_body/test_post.py @@ -42,7 +42,7 @@ def test_property_not_required_passes(self): { } ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_required_with_escaped_characters_request_body/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_required_with_escaped_characters_request_body/test_post.py index 607f5368732..719d03bd2b8 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_required_with_escaped_characters_request_body/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_required_with_escaped_characters_request_body/test_post.py @@ -47,7 +47,7 @@ def test_object_with_some_properties_missing_is_invalid_fails(self): } ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -73,7 +73,7 @@ def test_object_with_all_properties_present_is_valid_passes(self): 1, } ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_simple_enum_validation_request_body/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_simple_enum_validation_request_body/test_post.py index a6ee338a7e7..4b06cd2642e 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_simple_enum_validation_request_body/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_simple_enum_validation_request_body/test_post.py @@ -42,7 +42,7 @@ def test_something_else_is_invalid_fails(self): 4 ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -55,7 +55,7 @@ def test_one_of_the_enum_is_valid_passes(self): payload = ( 1 ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_string_type_matches_strings_request_body/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_string_type_matches_strings_request_body/test_post.py index 12f1e9bfefc..cdfe47c3cb8 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_string_type_matches_strings_request_body/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_string_type_matches_strings_request_body/test_post.py @@ -42,7 +42,7 @@ def test_1_is_not_a_string_fails(self): 1 ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -55,7 +55,7 @@ def test_a_string_is_still_a_string_even_if_it_looks_like_a_number_passes(self): payload = ( "1" ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -85,7 +85,7 @@ def test_an_empty_string_is_still_a_string_passes(self): payload = ( "" ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -116,7 +116,7 @@ def test_a_float_is_not_a_string_fails(self): 1.1 ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -131,7 +131,7 @@ def test_an_object_is_not_a_string_fails(self): } ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -146,7 +146,7 @@ def test_an_array_is_not_a_string_fails(self): ] ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -160,7 +160,7 @@ def test_a_boolean_is_not_a_string_fails(self): True ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -174,7 +174,7 @@ def test_null_is_not_a_string_fails(self): None ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -187,7 +187,7 @@ def test_a_string_is_a_string_passes(self): payload = ( "foo" ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_request_body/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_request_body/test_post.py index 56ea79de77d..8072150e5d1 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_request_body/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_request_body/test_post.py @@ -42,7 +42,7 @@ def test_missing_properties_are_not_filled_in_with_the_default_passes(self): { } ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -75,7 +75,7 @@ def test_an_explicit_property_value_is_checked_against_maximum_passing_passes(se 1, } ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -109,7 +109,7 @@ def test_an_explicit_property_value_is_checked_against_maximum_failing_fails(sel } ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_uniqueitems_false_validation_request_body/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_uniqueitems_false_validation_request_body/test_post.py index affd09c5194..4b64f9b5e68 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_uniqueitems_false_validation_request_body/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_uniqueitems_false_validation_request_body/test_post.py @@ -44,7 +44,7 @@ def test_non_unique_array_of_integers_is_valid_passes(self): 1, ] ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -83,7 +83,7 @@ def test_unique_array_of_objects_is_valid_passes(self): }, ] ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -134,7 +134,7 @@ def test_non_unique_array_of_nested_objects_is_valid_passes(self): }, ] ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -173,7 +173,7 @@ def test_non_unique_array_of_objects_is_valid_passes(self): }, ] ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -206,7 +206,7 @@ def test_1_and_true_are_unique_passes(self): True, ] ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -239,7 +239,7 @@ def test_unique_array_of_integers_is_valid_passes(self): 2, ] ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -276,7 +276,7 @@ def test_non_unique_array_of_arrays_is_valid_passes(self): ], ] ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -310,7 +310,7 @@ def test_numbers_are_unique_if_mathematically_unequal_passes(self): 1, ] ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -343,7 +343,7 @@ def test_false_is_not_equal_to_zero_passes(self): False, ] ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -394,7 +394,7 @@ def test_unique_array_of_nested_objects_is_valid_passes(self): }, ] ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -427,7 +427,7 @@ def test_0_and_false_are_unique_passes(self): False, ] ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -464,7 +464,7 @@ def test_unique_array_of_arrays_is_valid_passes(self): ], ] ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -497,7 +497,7 @@ def test_true_is_not_equal_to_one_passes(self): True, ] ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -538,7 +538,7 @@ def test_non_unique_heterogeneous_types_are_valid_passes(self): 1, ] ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -577,7 +577,7 @@ def test_unique_heterogeneous_types_are_valid_passes(self): 1, ] ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_uniqueitems_validation_request_body/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_uniqueitems_validation_request_body/test_post.py index 12d95ae7aef..be7e6cab0a4 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_uniqueitems_validation_request_body/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_uniqueitems_validation_request_body/test_post.py @@ -50,7 +50,7 @@ def test_unique_array_of_objects_is_valid_passes(self): }, ] ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -89,7 +89,7 @@ def test_a_true_and_a1_are_unique_passes(self): }, ] ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -131,7 +131,7 @@ def test_non_unique_heterogeneous_types_are_invalid_fails(self): ] ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -157,7 +157,7 @@ def test_nested0_and_false_are_unique_passes(self): ], ] ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -196,7 +196,7 @@ def test_a_false_and_a0_are_unique_passes(self): }, ] ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -231,7 +231,7 @@ def test_numbers_are_unique_if_mathematically_unequal_fails(self): ] ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -247,7 +247,7 @@ def test_false_is_not_equal_to_zero_passes(self): False, ] ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -284,7 +284,7 @@ def test_0_and_false_are_unique_passes(self): ], ] ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -321,7 +321,7 @@ def test_unique_array_of_arrays_is_valid_passes(self): ], ] ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -373,7 +373,7 @@ def test_non_unique_array_of_nested_objects_is_invalid_fails(self): ] ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -391,7 +391,7 @@ def test_non_unique_array_of_more_than_two_integers_is_invalid_fails(self): ] ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -407,7 +407,7 @@ def test_true_is_not_equal_to_one_passes(self): True, ] ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -451,7 +451,7 @@ def test_objects_are_non_unique_despite_key_order_fails(self): ] ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -468,7 +468,7 @@ def test_unique_array_of_strings_is_valid_passes(self): "baz", ] ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -505,7 +505,7 @@ def test_1_and_true_are_unique_passes(self): ], ] ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -548,7 +548,7 @@ def test_different_objects_are_unique_passes(self): }, ] ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -581,7 +581,7 @@ def test_unique_array_of_integers_is_valid_passes(self): 2, ] ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -622,7 +622,7 @@ def test_non_unique_array_of_more_than_two_arrays_is_invalid_fails(self): ] ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -645,7 +645,7 @@ def test_non_unique_array_of_objects_is_invalid_fails(self): ] ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -679,7 +679,7 @@ def test_unique_array_of_nested_objects_is_valid_passes(self): }, ] ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -717,7 +717,7 @@ def test_non_unique_array_of_arrays_is_invalid_fails(self): ] ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -735,7 +735,7 @@ def test_non_unique_array_of_strings_is_invalid_fails(self): ] ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -761,7 +761,7 @@ def test_nested1_and_true_are_unique_passes(self): ], ] ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -801,7 +801,7 @@ def test_unique_heterogeneous_types_are_valid_passes(self): "{}", ] ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -835,7 +835,7 @@ def test_non_unique_array_of_integers_is_invalid_fails(self): ] ) with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_uri_format_request_body/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_uri_format_request_body/test_post.py index 94a07cc1f57..f9f2c002947 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_uri_format_request_body/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_uri_format_request_body/test_post.py @@ -42,7 +42,7 @@ def test_all_string_formats_ignore_objects_passes(self): { } ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -72,7 +72,7 @@ def test_all_string_formats_ignore_booleans_passes(self): payload = ( False ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -102,7 +102,7 @@ def test_all_string_formats_ignore_integers_passes(self): payload = ( 12 ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -132,7 +132,7 @@ def test_all_string_formats_ignore_floats_passes(self): payload = ( 13.7 ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -163,7 +163,7 @@ def test_all_string_formats_ignore_arrays_passes(self): [ ] ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -193,7 +193,7 @@ def test_all_string_formats_ignore_nulls_passes(self): payload = ( None ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_uri_reference_format_request_body/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_uri_reference_format_request_body/test_post.py index 9dfca7bbc66..22574fbab71 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_uri_reference_format_request_body/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_uri_reference_format_request_body/test_post.py @@ -42,7 +42,7 @@ def test_all_string_formats_ignore_objects_passes(self): { } ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -72,7 +72,7 @@ def test_all_string_formats_ignore_booleans_passes(self): payload = ( False ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -102,7 +102,7 @@ def test_all_string_formats_ignore_integers_passes(self): payload = ( 12 ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -132,7 +132,7 @@ def test_all_string_formats_ignore_floats_passes(self): payload = ( 13.7 ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -163,7 +163,7 @@ def test_all_string_formats_ignore_arrays_passes(self): [ ] ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -193,7 +193,7 @@ def test_all_string_formats_ignore_nulls_passes(self): payload = ( None ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_uri_template_format_request_body/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_uri_template_format_request_body/test_post.py index 93544bef168..c3a5d713fc4 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_uri_template_format_request_body/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_request_body_post_uri_template_format_request_body/test_post.py @@ -42,7 +42,7 @@ def test_all_string_formats_ignore_objects_passes(self): { } ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -72,7 +72,7 @@ def test_all_string_formats_ignore_booleans_passes(self): payload = ( False ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -102,7 +102,7 @@ def test_all_string_formats_ignore_integers_passes(self): payload = ( 12 ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -132,7 +132,7 @@ def test_all_string_formats_ignore_floats_passes(self): payload = ( 13.7 ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -163,7 +163,7 @@ def test_all_string_formats_ignore_arrays_passes(self): [ ] ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -193,7 +193,7 @@ def test_all_string_formats_ignore_nulls_passes(self): payload = ( None ) - body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg( + body = post.RequestBody.Schemas.application_json.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_additionalproperties_allows_a_schema_which_should_validate_response_body_for_content_types/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_additionalproperties_allows_a_schema_which_should_validate_response_body_for_content_types/test_post.py index 4c408162b7c..d82cd2bc5bf 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_additionalproperties_allows_a_schema_which_should_validate_response_body_for_content_types/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_additionalproperties_allows_a_schema_which_should_validate_response_body_for_content_types/test_post.py @@ -32,6 +32,7 @@ def tearDown(self): pass response_status = 200 + response_body_schema = post.response_for_200.BodySchemas.application_json def test_no_additional_properties_is_valid_passes(self): # no additional properties is valid @@ -59,8 +60,8 @@ def test_no_additional_properties_is_valid_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -127,8 +128,8 @@ def test_an_additional_valid_property_is_valid_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_additionalproperties_are_allowed_by_default_response_body_for_content_types/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_additionalproperties_are_allowed_by_default_response_body_for_content_types/test_post.py index 2a8383382a9..e66447ddfc1 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_additionalproperties_are_allowed_by_default_response_body_for_content_types/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_additionalproperties_are_allowed_by_default_response_body_for_content_types/test_post.py @@ -32,6 +32,7 @@ def tearDown(self): pass response_status = 200 + response_body_schema = post.response_for_200.BodySchemas.application_json def test_additional_properties_are_allowed_passes(self): # additional properties are allowed @@ -63,8 +64,8 @@ def test_additional_properties_are_allowed_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_additionalproperties_can_exist_by_itself_response_body_for_content_types/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_additionalproperties_can_exist_by_itself_response_body_for_content_types/test_post.py index fa6be7937ed..c85a29953d4 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_additionalproperties_can_exist_by_itself_response_body_for_content_types/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_additionalproperties_can_exist_by_itself_response_body_for_content_types/test_post.py @@ -32,6 +32,7 @@ def tearDown(self): pass response_status = 200 + response_body_schema = post.response_for_200.BodySchemas.application_json def test_an_additional_invalid_property_is_invalid_fails(self): # an additional invalid property is invalid @@ -86,8 +87,8 @@ def test_an_additional_valid_property_is_valid_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_additionalproperties_should_not_look_in_applicators_response_body_for_content_types/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_additionalproperties_should_not_look_in_applicators_response_body_for_content_types/test_post.py index 66faadd6a08..1d1416eae79 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_additionalproperties_should_not_look_in_applicators_response_body_for_content_types/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_additionalproperties_should_not_look_in_applicators_response_body_for_content_types/test_post.py @@ -32,6 +32,7 @@ def tearDown(self): pass response_status = 200 + response_body_schema = post.response_for_200.BodySchemas.application_json def test_properties_defined_in_allof_are_not_examined_fails(self): # properties defined in allOf are not examined @@ -90,8 +91,8 @@ def test_valid_test_case_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_allof_combined_with_anyof_oneof_response_body_for_content_types/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_allof_combined_with_anyof_oneof_response_body_for_content_types/test_post.py index 50707b5fb2b..2390d4d856d 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_allof_combined_with_anyof_oneof_response_body_for_content_types/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_allof_combined_with_anyof_oneof_response_body_for_content_types/test_post.py @@ -32,6 +32,7 @@ def tearDown(self): pass response_status = 200 + response_body_schema = post.response_for_200.BodySchemas.application_json def test_allof_true_anyof_false_oneof_false_fails(self): # allOf: true, anyOf: false, oneOf: false @@ -152,8 +153,8 @@ def test_allof_true_anyof_true_oneof_true_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_allof_response_body_for_content_types/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_allof_response_body_for_content_types/test_post.py index dae63942115..3b579d9d2fc 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_allof_response_body_for_content_types/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_allof_response_body_for_content_types/test_post.py @@ -32,6 +32,7 @@ def tearDown(self): pass response_status = 200 + response_body_schema = post.response_for_200.BodySchemas.application_json def test_allof_passes(self): # allOf @@ -61,8 +62,8 @@ def test_allof_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_allof_simple_types_response_body_for_content_types/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_allof_simple_types_response_body_for_content_types/test_post.py index 7713cf8e733..d56a695a300 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_allof_simple_types_response_body_for_content_types/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_allof_simple_types_response_body_for_content_types/test_post.py @@ -32,6 +32,7 @@ def tearDown(self): pass response_status = 200 + response_body_schema = post.response_for_200.BodySchemas.application_json def test_valid_passes(self): # valid @@ -56,8 +57,8 @@ def test_valid_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_allof_with_base_schema_response_body_for_content_types/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_allof_with_base_schema_response_body_for_content_types/test_post.py index 42142f307ea..520957259d2 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_allof_with_base_schema_response_body_for_content_types/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_allof_with_base_schema_response_body_for_content_types/test_post.py @@ -32,6 +32,7 @@ def tearDown(self): pass response_status = 200 + response_body_schema = post.response_for_200.BodySchemas.application_json def test_valid_passes(self): # valid @@ -63,8 +64,8 @@ def test_valid_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_allof_with_one_empty_schema_response_body_for_content_types/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_allof_with_one_empty_schema_response_body_for_content_types/test_post.py index 68d704af400..963827ff11d 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_allof_with_one_empty_schema_response_body_for_content_types/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_allof_with_one_empty_schema_response_body_for_content_types/test_post.py @@ -32,6 +32,7 @@ def tearDown(self): pass response_status = 200 + response_body_schema = post.response_for_200.BodySchemas.application_json def test_any_data_is_valid_passes(self): # any data is valid @@ -56,8 +57,8 @@ def test_any_data_is_valid_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_allof_with_the_first_empty_schema_response_body_for_content_types/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_allof_with_the_first_empty_schema_response_body_for_content_types/test_post.py index 0d11bae4dbb..e3ec9ad5549 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_allof_with_the_first_empty_schema_response_body_for_content_types/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_allof_with_the_first_empty_schema_response_body_for_content_types/test_post.py @@ -32,6 +32,7 @@ def tearDown(self): pass response_status = 200 + response_body_schema = post.response_for_200.BodySchemas.application_json def test_string_is_invalid_fails(self): # string is invalid @@ -80,8 +81,8 @@ def test_number_is_valid_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_allof_with_the_last_empty_schema_response_body_for_content_types/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_allof_with_the_last_empty_schema_response_body_for_content_types/test_post.py index 557fe4b7496..246653d7964 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_allof_with_the_last_empty_schema_response_body_for_content_types/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_allof_with_the_last_empty_schema_response_body_for_content_types/test_post.py @@ -32,6 +32,7 @@ def tearDown(self): pass response_status = 200 + response_body_schema = post.response_for_200.BodySchemas.application_json def test_string_is_invalid_fails(self): # string is invalid @@ -80,8 +81,8 @@ def test_number_is_valid_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_allof_with_two_empty_schemas_response_body_for_content_types/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_allof_with_two_empty_schemas_response_body_for_content_types/test_post.py index 3e280d443b0..dc46c923e40 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_allof_with_two_empty_schemas_response_body_for_content_types/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_allof_with_two_empty_schemas_response_body_for_content_types/test_post.py @@ -32,6 +32,7 @@ def tearDown(self): pass response_status = 200 + response_body_schema = post.response_for_200.BodySchemas.application_json def test_any_data_is_valid_passes(self): # any data is valid @@ -56,8 +57,8 @@ def test_any_data_is_valid_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_anyof_complex_types_response_body_for_content_types/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_anyof_complex_types_response_body_for_content_types/test_post.py index 2a40c9b558f..fc65fa4639f 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_anyof_complex_types_response_body_for_content_types/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_anyof_complex_types_response_body_for_content_types/test_post.py @@ -32,6 +32,7 @@ def tearDown(self): pass response_status = 200 + response_body_schema = post.response_for_200.BodySchemas.application_json def test_second_anyof_valid_complex_passes(self): # second anyOf valid (complex) @@ -59,8 +60,8 @@ def test_second_anyof_valid_complex_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -123,8 +124,8 @@ def test_both_anyof_valid_complex_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -156,8 +157,8 @@ def test_first_anyof_valid_complex_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_anyof_response_body_for_content_types/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_anyof_response_body_for_content_types/test_post.py index 7707cd74acf..b3281057a86 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_anyof_response_body_for_content_types/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_anyof_response_body_for_content_types/test_post.py @@ -32,6 +32,7 @@ def tearDown(self): pass response_status = 200 + response_body_schema = post.response_for_200.BodySchemas.application_json def test_second_anyof_valid_passes(self): # second anyOf valid @@ -56,8 +57,8 @@ def test_second_anyof_valid_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -110,8 +111,8 @@ def test_both_anyof_valid_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -140,8 +141,8 @@ def test_first_anyof_valid_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_anyof_with_base_schema_response_body_for_content_types/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_anyof_with_base_schema_response_body_for_content_types/test_post.py index d8981bb737f..928681c880e 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_anyof_with_base_schema_response_body_for_content_types/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_anyof_with_base_schema_response_body_for_content_types/test_post.py @@ -32,6 +32,7 @@ def tearDown(self): pass response_status = 200 + response_body_schema = post.response_for_200.BodySchemas.application_json def test_one_anyof_valid_passes(self): # one anyOf valid @@ -56,8 +57,8 @@ def test_one_anyof_valid_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_anyof_with_one_empty_schema_response_body_for_content_types/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_anyof_with_one_empty_schema_response_body_for_content_types/test_post.py index d8a37341e9b..0024d9d5a4f 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_anyof_with_one_empty_schema_response_body_for_content_types/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_anyof_with_one_empty_schema_response_body_for_content_types/test_post.py @@ -32,6 +32,7 @@ def tearDown(self): pass response_status = 200 + response_body_schema = post.response_for_200.BodySchemas.application_json def test_string_is_valid_passes(self): # string is valid @@ -56,8 +57,8 @@ def test_string_is_valid_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -86,8 +87,8 @@ def test_number_is_valid_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_array_type_matches_arrays_response_body_for_content_types/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_array_type_matches_arrays_response_body_for_content_types/test_post.py index 717a6d1e2d9..7f064a6f4fe 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_array_type_matches_arrays_response_body_for_content_types/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_array_type_matches_arrays_response_body_for_content_types/test_post.py @@ -32,6 +32,7 @@ def tearDown(self): pass response_status = 200 + response_body_schema = post.response_for_200.BodySchemas.application_json def test_a_float_is_not_an_array_fails(self): # a float is not an array @@ -178,8 +179,8 @@ def test_an_array_is_an_array_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_boolean_type_matches_booleans_response_body_for_content_types/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_boolean_type_matches_booleans_response_body_for_content_types/test_post.py index f4daf112ba0..4a7415a4256 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_boolean_type_matches_booleans_response_body_for_content_types/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_boolean_type_matches_booleans_response_body_for_content_types/test_post.py @@ -32,6 +32,7 @@ def tearDown(self): pass response_status = 200 + response_body_schema = post.response_for_200.BodySchemas.application_json def test_an_empty_string_is_not_a_boolean_fails(self): # an empty string is not a boolean @@ -201,8 +202,8 @@ def test_false_is_a_boolean_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -255,8 +256,8 @@ def test_true_is_a_boolean_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_by_int_response_body_for_content_types/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_by_int_response_body_for_content_types/test_post.py index ccb4450d001..728787591c4 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_by_int_response_body_for_content_types/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_by_int_response_body_for_content_types/test_post.py @@ -32,6 +32,7 @@ def tearDown(self): pass response_status = 200 + response_body_schema = post.response_for_200.BodySchemas.application_json def test_int_by_int_fail_fails(self): # int by int fail @@ -80,8 +81,8 @@ def test_int_by_int_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -110,8 +111,8 @@ def test_ignores_non_numbers_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_by_number_response_body_for_content_types/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_by_number_response_body_for_content_types/test_post.py index 553452dd34d..d5c9c6816bf 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_by_number_response_body_for_content_types/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_by_number_response_body_for_content_types/test_post.py @@ -32,6 +32,7 @@ def tearDown(self): pass response_status = 200 + response_body_schema = post.response_for_200.BodySchemas.application_json def test_45_is_multiple_of15_passes(self): # 4.5 is multiple of 1.5 @@ -56,8 +57,8 @@ def test_45_is_multiple_of15_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -110,8 +111,8 @@ def test_zero_is_multiple_of_anything_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_by_small_number_response_body_for_content_types/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_by_small_number_response_body_for_content_types/test_post.py index c8e0af97ede..141ad17631f 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_by_small_number_response_body_for_content_types/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_by_small_number_response_body_for_content_types/test_post.py @@ -32,6 +32,7 @@ def tearDown(self): pass response_status = 200 + response_body_schema = post.response_for_200.BodySchemas.application_json def test_000751_is_not_multiple_of00001_fails(self): # 0.00751 is not multiple of 0.0001 @@ -80,8 +81,8 @@ def test_00075_is_multiple_of00001_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_date_time_format_response_body_for_content_types/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_date_time_format_response_body_for_content_types/test_post.py index 813449ce9a1..0f44295bdd6 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_date_time_format_response_body_for_content_types/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_date_time_format_response_body_for_content_types/test_post.py @@ -32,6 +32,7 @@ def tearDown(self): pass response_status = 200 + response_body_schema = post.response_for_200.BodySchemas.application_json def test_all_string_formats_ignore_objects_passes(self): # all string formats ignore objects @@ -57,8 +58,8 @@ def test_all_string_formats_ignore_objects_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -87,8 +88,8 @@ def test_all_string_formats_ignore_booleans_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -117,8 +118,8 @@ def test_all_string_formats_ignore_integers_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -147,8 +148,8 @@ def test_all_string_formats_ignore_floats_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -178,8 +179,8 @@ def test_all_string_formats_ignore_arrays_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -208,8 +209,8 @@ def test_all_string_formats_ignore_nulls_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_email_format_response_body_for_content_types/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_email_format_response_body_for_content_types/test_post.py index 0d82125e127..10b9956c894 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_email_format_response_body_for_content_types/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_email_format_response_body_for_content_types/test_post.py @@ -32,6 +32,7 @@ def tearDown(self): pass response_status = 200 + response_body_schema = post.response_for_200.BodySchemas.application_json def test_all_string_formats_ignore_objects_passes(self): # all string formats ignore objects @@ -57,8 +58,8 @@ def test_all_string_formats_ignore_objects_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -87,8 +88,8 @@ def test_all_string_formats_ignore_booleans_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -117,8 +118,8 @@ def test_all_string_formats_ignore_integers_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -147,8 +148,8 @@ def test_all_string_formats_ignore_floats_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -178,8 +179,8 @@ def test_all_string_formats_ignore_arrays_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -208,8 +209,8 @@ def test_all_string_formats_ignore_nulls_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_enum_with0_does_not_match_false_response_body_for_content_types/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_enum_with0_does_not_match_false_response_body_for_content_types/test_post.py index 35e22564157..546ce2b55b2 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_enum_with0_does_not_match_false_response_body_for_content_types/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_enum_with0_does_not_match_false_response_body_for_content_types/test_post.py @@ -32,6 +32,7 @@ def tearDown(self): pass response_status = 200 + response_body_schema = post.response_for_200.BodySchemas.application_json def test_integer_zero_is_valid_passes(self): # integer zero is valid @@ -56,8 +57,8 @@ def test_integer_zero_is_valid_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -86,8 +87,8 @@ def test_float_zero_is_valid_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_enum_with1_does_not_match_true_response_body_for_content_types/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_enum_with1_does_not_match_true_response_body_for_content_types/test_post.py index 3ddc9a784b8..f7ed9423e77 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_enum_with1_does_not_match_true_response_body_for_content_types/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_enum_with1_does_not_match_true_response_body_for_content_types/test_post.py @@ -32,6 +32,7 @@ def tearDown(self): pass response_status = 200 + response_body_schema = post.response_for_200.BodySchemas.application_json def test_true_is_invalid_fails(self): # true is invalid @@ -80,8 +81,8 @@ def test_integer_one_is_valid_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -110,8 +111,8 @@ def test_float_one_is_valid_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_enum_with_escaped_characters_response_body_for_content_types/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_enum_with_escaped_characters_response_body_for_content_types/test_post.py index a775da33fc4..2a85c737678 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_enum_with_escaped_characters_response_body_for_content_types/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_enum_with_escaped_characters_response_body_for_content_types/test_post.py @@ -32,6 +32,7 @@ def tearDown(self): pass response_status = 200 + response_body_schema = post.response_for_200.BodySchemas.application_json def test_member2_is_valid_passes(self): # member 2 is valid @@ -56,8 +57,8 @@ def test_member2_is_valid_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -86,8 +87,8 @@ def test_member1_is_valid_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_enum_with_false_does_not_match0_response_body_for_content_types/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_enum_with_false_does_not_match0_response_body_for_content_types/test_post.py index 229b64beab5..0a55b5fabf9 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_enum_with_false_does_not_match0_response_body_for_content_types/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_enum_with_false_does_not_match0_response_body_for_content_types/test_post.py @@ -32,6 +32,7 @@ def tearDown(self): pass response_status = 200 + response_body_schema = post.response_for_200.BodySchemas.application_json def test_false_is_valid_passes(self): # false is valid @@ -56,8 +57,8 @@ def test_false_is_valid_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_enum_with_true_does_not_match1_response_body_for_content_types/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_enum_with_true_does_not_match1_response_body_for_content_types/test_post.py index abb8635973d..05e2b1ec0d6 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_enum_with_true_does_not_match1_response_body_for_content_types/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_enum_with_true_does_not_match1_response_body_for_content_types/test_post.py @@ -32,6 +32,7 @@ def tearDown(self): pass response_status = 200 + response_body_schema = post.response_for_200.BodySchemas.application_json def test_float_one_is_invalid_fails(self): # float one is invalid @@ -80,8 +81,8 @@ def test_true_is_valid_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_enums_in_properties_response_body_for_content_types/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_enums_in_properties_response_body_for_content_types/test_post.py index 59f2f9b9acb..37bece9641d 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_enums_in_properties_response_body_for_content_types/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_enums_in_properties_response_body_for_content_types/test_post.py @@ -32,6 +32,7 @@ def tearDown(self): pass response_status = 200 + response_body_schema = post.response_for_200.BodySchemas.application_json def test_missing_optional_property_is_valid_passes(self): # missing optional property is valid @@ -59,8 +60,8 @@ def test_missing_optional_property_is_valid_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -123,8 +124,8 @@ def test_both_properties_are_valid_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_forbidden_property_response_body_for_content_types/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_forbidden_property_response_body_for_content_types/test_post.py index 5610f1bd7aa..91f0f7a5004 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_forbidden_property_response_body_for_content_types/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_forbidden_property_response_body_for_content_types/test_post.py @@ -32,6 +32,7 @@ def tearDown(self): pass response_status = 200 + response_body_schema = post.response_for_200.BodySchemas.application_json def test_property_present_fails(self): # property present @@ -90,8 +91,8 @@ def test_property_absent_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_hostname_format_response_body_for_content_types/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_hostname_format_response_body_for_content_types/test_post.py index ac74108dd33..430d6a171a4 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_hostname_format_response_body_for_content_types/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_hostname_format_response_body_for_content_types/test_post.py @@ -32,6 +32,7 @@ def tearDown(self): pass response_status = 200 + response_body_schema = post.response_for_200.BodySchemas.application_json def test_all_string_formats_ignore_objects_passes(self): # all string formats ignore objects @@ -57,8 +58,8 @@ def test_all_string_formats_ignore_objects_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -87,8 +88,8 @@ def test_all_string_formats_ignore_booleans_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -117,8 +118,8 @@ def test_all_string_formats_ignore_integers_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -147,8 +148,8 @@ def test_all_string_formats_ignore_floats_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -178,8 +179,8 @@ def test_all_string_formats_ignore_arrays_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -208,8 +209,8 @@ def test_all_string_formats_ignore_nulls_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_integer_type_matches_integers_response_body_for_content_types/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_integer_type_matches_integers_response_body_for_content_types/test_post.py index c772cd05dc4..d5e897f3443 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_integer_type_matches_integers_response_body_for_content_types/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_integer_type_matches_integers_response_body_for_content_types/test_post.py @@ -32,6 +32,7 @@ def tearDown(self): pass response_status = 200 + response_body_schema = post.response_for_200.BodySchemas.application_json def test_an_object_is_not_an_integer_fails(self): # an object is not an integer @@ -129,8 +130,8 @@ def test_a_float_with_zero_fractional_part_is_an_integer_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -207,8 +208,8 @@ def test_an_integer_is_an_integer_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_invalid_instance_should_not_raise_error_when_float_division_inf_response_body_for_content_types/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_invalid_instance_should_not_raise_error_when_float_division_inf_response_body_for_content_types/test_post.py index a198deb37b7..68bc902e849 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_invalid_instance_should_not_raise_error_when_float_division_inf_response_body_for_content_types/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_invalid_instance_should_not_raise_error_when_float_division_inf_response_body_for_content_types/test_post.py @@ -32,6 +32,7 @@ def tearDown(self): pass response_status = 200 + response_body_schema = post.response_for_200.BodySchemas.application_json def test_always_invalid_but_naive_implementations_may_raise_an_overflow_error_fails(self): # always invalid, but naive implementations may raise an overflow error @@ -80,8 +81,8 @@ def test_valid_integer_with_multipleof_float_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_invalid_string_value_for_default_response_body_for_content_types/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_invalid_string_value_for_default_response_body_for_content_types/test_post.py index 3cd375f9db4..fff82ac6a1f 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_invalid_string_value_for_default_response_body_for_content_types/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_invalid_string_value_for_default_response_body_for_content_types/test_post.py @@ -32,6 +32,7 @@ def tearDown(self): pass response_status = 200 + response_body_schema = post.response_for_200.BodySchemas.application_json def test_valid_when_property_is_specified_passes(self): # valid when property is specified @@ -59,8 +60,8 @@ def test_valid_when_property_is_specified_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -90,8 +91,8 @@ def test_still_valid_when_the_invalid_default_is_used_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_ipv4_format_response_body_for_content_types/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_ipv4_format_response_body_for_content_types/test_post.py index 4804e8e5a12..d887cf6a3f2 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_ipv4_format_response_body_for_content_types/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_ipv4_format_response_body_for_content_types/test_post.py @@ -32,6 +32,7 @@ def tearDown(self): pass response_status = 200 + response_body_schema = post.response_for_200.BodySchemas.application_json def test_all_string_formats_ignore_objects_passes(self): # all string formats ignore objects @@ -57,8 +58,8 @@ def test_all_string_formats_ignore_objects_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -87,8 +88,8 @@ def test_all_string_formats_ignore_booleans_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -117,8 +118,8 @@ def test_all_string_formats_ignore_integers_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -147,8 +148,8 @@ def test_all_string_formats_ignore_floats_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -178,8 +179,8 @@ def test_all_string_formats_ignore_arrays_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -208,8 +209,8 @@ def test_all_string_formats_ignore_nulls_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_ipv6_format_response_body_for_content_types/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_ipv6_format_response_body_for_content_types/test_post.py index b63faab6c47..61527310c40 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_ipv6_format_response_body_for_content_types/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_ipv6_format_response_body_for_content_types/test_post.py @@ -32,6 +32,7 @@ def tearDown(self): pass response_status = 200 + response_body_schema = post.response_for_200.BodySchemas.application_json def test_all_string_formats_ignore_objects_passes(self): # all string formats ignore objects @@ -57,8 +58,8 @@ def test_all_string_formats_ignore_objects_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -87,8 +88,8 @@ def test_all_string_formats_ignore_booleans_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -117,8 +118,8 @@ def test_all_string_formats_ignore_integers_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -147,8 +148,8 @@ def test_all_string_formats_ignore_floats_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -178,8 +179,8 @@ def test_all_string_formats_ignore_arrays_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -208,8 +209,8 @@ def test_all_string_formats_ignore_nulls_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_json_pointer_format_response_body_for_content_types/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_json_pointer_format_response_body_for_content_types/test_post.py index 49e2e9df945..ee579763cb4 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_json_pointer_format_response_body_for_content_types/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_json_pointer_format_response_body_for_content_types/test_post.py @@ -32,6 +32,7 @@ def tearDown(self): pass response_status = 200 + response_body_schema = post.response_for_200.BodySchemas.application_json def test_all_string_formats_ignore_objects_passes(self): # all string formats ignore objects @@ -57,8 +58,8 @@ def test_all_string_formats_ignore_objects_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -87,8 +88,8 @@ def test_all_string_formats_ignore_booleans_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -117,8 +118,8 @@ def test_all_string_formats_ignore_integers_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -147,8 +148,8 @@ def test_all_string_formats_ignore_floats_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -178,8 +179,8 @@ def test_all_string_formats_ignore_arrays_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -208,8 +209,8 @@ def test_all_string_formats_ignore_nulls_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_maximum_validation_response_body_for_content_types/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_maximum_validation_response_body_for_content_types/test_post.py index 42ccfe7cb15..6332ce3df76 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_maximum_validation_response_body_for_content_types/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_maximum_validation_response_body_for_content_types/test_post.py @@ -32,6 +32,7 @@ def tearDown(self): pass response_status = 200 + response_body_schema = post.response_for_200.BodySchemas.application_json def test_below_the_maximum_is_valid_passes(self): # below the maximum is valid @@ -56,8 +57,8 @@ def test_below_the_maximum_is_valid_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -86,8 +87,8 @@ def test_boundary_point_is_valid_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -140,8 +141,8 @@ def test_ignores_non_numbers_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_maximum_validation_with_unsigned_integer_response_body_for_content_types/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_maximum_validation_with_unsigned_integer_response_body_for_content_types/test_post.py index 725ca59dd94..a376d13302e 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_maximum_validation_with_unsigned_integer_response_body_for_content_types/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_maximum_validation_with_unsigned_integer_response_body_for_content_types/test_post.py @@ -32,6 +32,7 @@ def tearDown(self): pass response_status = 200 + response_body_schema = post.response_for_200.BodySchemas.application_json def test_below_the_maximum_is_invalid_passes(self): # below the maximum is invalid @@ -56,8 +57,8 @@ def test_below_the_maximum_is_invalid_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -110,8 +111,8 @@ def test_boundary_point_integer_is_valid_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -140,8 +141,8 @@ def test_boundary_point_float_is_valid_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_maxitems_validation_response_body_for_content_types/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_maxitems_validation_response_body_for_content_types/test_post.py index d297f38843b..b247136e3ab 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_maxitems_validation_response_body_for_content_types/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_maxitems_validation_response_body_for_content_types/test_post.py @@ -32,6 +32,7 @@ def tearDown(self): pass response_status = 200 + response_body_schema = post.response_for_200.BodySchemas.application_json def test_too_long_is_invalid_fails(self): # too long is invalid @@ -84,8 +85,8 @@ def test_ignores_non_arrays_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -116,8 +117,8 @@ def test_shorter_is_valid_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -149,8 +150,8 @@ def test_exact_length_is_valid_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_maxlength_validation_response_body_for_content_types/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_maxlength_validation_response_body_for_content_types/test_post.py index 7f5622b34b5..6432226a98b 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_maxlength_validation_response_body_for_content_types/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_maxlength_validation_response_body_for_content_types/test_post.py @@ -32,6 +32,7 @@ def tearDown(self): pass response_status = 200 + response_body_schema = post.response_for_200.BodySchemas.application_json def test_too_long_is_invalid_fails(self): # too long is invalid @@ -80,8 +81,8 @@ def test_ignores_non_strings_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -110,8 +111,8 @@ def test_shorter_is_valid_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -140,8 +141,8 @@ def test_two_supplementary_unicode_code_points_is_long_enough_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -170,8 +171,8 @@ def test_exact_length_is_valid_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_maxproperties0_means_the_object_is_empty_response_body_for_content_types/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_maxproperties0_means_the_object_is_empty_response_body_for_content_types/test_post.py index 58145de0411..a1e7310dcf6 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_maxproperties0_means_the_object_is_empty_response_body_for_content_types/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_maxproperties0_means_the_object_is_empty_response_body_for_content_types/test_post.py @@ -32,6 +32,7 @@ def tearDown(self): pass response_status = 200 + response_body_schema = post.response_for_200.BodySchemas.application_json def test_no_properties_is_valid_passes(self): # no properties is valid @@ -57,8 +58,8 @@ def test_no_properties_is_valid_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_maxproperties_validation_response_body_for_content_types/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_maxproperties_validation_response_body_for_content_types/test_post.py index 28a24d6e03f..0da83dac049 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_maxproperties_validation_response_body_for_content_types/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_maxproperties_validation_response_body_for_content_types/test_post.py @@ -32,6 +32,7 @@ def tearDown(self): pass response_status = 200 + response_body_schema = post.response_for_200.BodySchemas.application_json def test_too_long_is_invalid_fails(self): # too long is invalid @@ -91,8 +92,8 @@ def test_ignores_arrays_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -121,8 +122,8 @@ def test_ignores_other_non_objects_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -151,8 +152,8 @@ def test_ignores_strings_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -184,8 +185,8 @@ def test_shorter_is_valid_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -219,8 +220,8 @@ def test_exact_length_is_valid_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_minimum_validation_response_body_for_content_types/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_minimum_validation_response_body_for_content_types/test_post.py index ca262ddbde2..51f2c384876 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_minimum_validation_response_body_for_content_types/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_minimum_validation_response_body_for_content_types/test_post.py @@ -32,6 +32,7 @@ def tearDown(self): pass response_status = 200 + response_body_schema = post.response_for_200.BodySchemas.application_json def test_boundary_point_is_valid_passes(self): # boundary point is valid @@ -56,8 +57,8 @@ def test_boundary_point_is_valid_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -110,8 +111,8 @@ def test_above_the_minimum_is_valid_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -140,8 +141,8 @@ def test_ignores_non_numbers_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_minimum_validation_with_signed_integer_response_body_for_content_types/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_minimum_validation_with_signed_integer_response_body_for_content_types/test_post.py index d5842cf8a47..168a1c5453e 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_minimum_validation_with_signed_integer_response_body_for_content_types/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_minimum_validation_with_signed_integer_response_body_for_content_types/test_post.py @@ -32,6 +32,7 @@ def tearDown(self): pass response_status = 200 + response_body_schema = post.response_for_200.BodySchemas.application_json def test_boundary_point_is_valid_passes(self): # boundary point is valid @@ -56,8 +57,8 @@ def test_boundary_point_is_valid_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -86,8 +87,8 @@ def test_positive_above_the_minimum_is_valid_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -164,8 +165,8 @@ def test_boundary_point_with_float_is_valid_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -194,8 +195,8 @@ def test_negative_above_the_minimum_is_valid_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -224,8 +225,8 @@ def test_ignores_non_numbers_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_minitems_validation_response_body_for_content_types/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_minitems_validation_response_body_for_content_types/test_post.py index 4450462f998..1dcffdd7cb4 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_minitems_validation_response_body_for_content_types/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_minitems_validation_response_body_for_content_types/test_post.py @@ -32,6 +32,7 @@ def tearDown(self): pass response_status = 200 + response_body_schema = post.response_for_200.BodySchemas.application_json def test_too_short_is_invalid_fails(self): # too short is invalid @@ -81,8 +82,8 @@ def test_ignores_non_arrays_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -114,8 +115,8 @@ def test_longer_is_valid_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -146,8 +147,8 @@ def test_exact_length_is_valid_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_minlength_validation_response_body_for_content_types/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_minlength_validation_response_body_for_content_types/test_post.py index 247a17756b0..528ed105b0c 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_minlength_validation_response_body_for_content_types/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_minlength_validation_response_body_for_content_types/test_post.py @@ -32,6 +32,7 @@ def tearDown(self): pass response_status = 200 + response_body_schema = post.response_for_200.BodySchemas.application_json def test_too_short_is_invalid_fails(self): # too short is invalid @@ -104,8 +105,8 @@ def test_longer_is_valid_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -134,8 +135,8 @@ def test_ignores_non_strings_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -164,8 +165,8 @@ def test_exact_length_is_valid_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_minproperties_validation_response_body_for_content_types/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_minproperties_validation_response_body_for_content_types/test_post.py index 2f3aadb3583..ef5c5db282b 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_minproperties_validation_response_body_for_content_types/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_minproperties_validation_response_body_for_content_types/test_post.py @@ -32,6 +32,7 @@ def tearDown(self): pass response_status = 200 + response_body_schema = post.response_for_200.BodySchemas.application_json def test_ignores_arrays_passes(self): # ignores arrays @@ -57,8 +58,8 @@ def test_ignores_arrays_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -87,8 +88,8 @@ def test_ignores_other_non_objects_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -142,8 +143,8 @@ def test_ignores_strings_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -177,8 +178,8 @@ def test_longer_is_valid_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -210,8 +211,8 @@ def test_exact_length_is_valid_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_nested_allof_to_check_validation_semantics_response_body_for_content_types/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_nested_allof_to_check_validation_semantics_response_body_for_content_types/test_post.py index 9d8f8fbf930..810cd7984ff 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_nested_allof_to_check_validation_semantics_response_body_for_content_types/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_nested_allof_to_check_validation_semantics_response_body_for_content_types/test_post.py @@ -32,6 +32,7 @@ def tearDown(self): pass response_status = 200 + response_body_schema = post.response_for_200.BodySchemas.application_json def test_anything_non_null_is_invalid_fails(self): # anything non-null is invalid @@ -80,8 +81,8 @@ def test_null_is_valid_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_nested_anyof_to_check_validation_semantics_response_body_for_content_types/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_nested_anyof_to_check_validation_semantics_response_body_for_content_types/test_post.py index 8fc358252fb..1974ddb5102 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_nested_anyof_to_check_validation_semantics_response_body_for_content_types/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_nested_anyof_to_check_validation_semantics_response_body_for_content_types/test_post.py @@ -32,6 +32,7 @@ def tearDown(self): pass response_status = 200 + response_body_schema = post.response_for_200.BodySchemas.application_json def test_anything_non_null_is_invalid_fails(self): # anything non-null is invalid @@ -80,8 +81,8 @@ def test_null_is_valid_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_nested_items_response_body_for_content_types/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_nested_items_response_body_for_content_types/test_post.py index ffb0092cb84..8fd0db7f32a 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_nested_items_response_body_for_content_types/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_nested_items_response_body_for_content_types/test_post.py @@ -32,6 +32,7 @@ def tearDown(self): pass response_status = 200 + response_body_schema = post.response_for_200.BodySchemas.application_json def test_valid_nested_array_passes(self): # valid nested array @@ -85,8 +86,8 @@ def test_valid_nested_array_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_nested_oneof_to_check_validation_semantics_response_body_for_content_types/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_nested_oneof_to_check_validation_semantics_response_body_for_content_types/test_post.py index 188ce661ff1..35a8994ab85 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_nested_oneof_to_check_validation_semantics_response_body_for_content_types/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_nested_oneof_to_check_validation_semantics_response_body_for_content_types/test_post.py @@ -32,6 +32,7 @@ def tearDown(self): pass response_status = 200 + response_body_schema = post.response_for_200.BodySchemas.application_json def test_anything_non_null_is_invalid_fails(self): # anything non-null is invalid @@ -80,8 +81,8 @@ def test_null_is_valid_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_not_more_complex_schema_response_body_for_content_types/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_not_more_complex_schema_response_body_for_content_types/test_post.py index 4b615daed14..a5b82d8ed06 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_not_more_complex_schema_response_body_for_content_types/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_not_more_complex_schema_response_body_for_content_types/test_post.py @@ -32,6 +32,7 @@ def tearDown(self): pass response_status = 200 + response_body_schema = post.response_for_200.BodySchemas.application_json def test_other_match_passes(self): # other match @@ -59,8 +60,8 @@ def test_other_match_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -116,8 +117,8 @@ def test_match_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_not_response_body_for_content_types/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_not_response_body_for_content_types/test_post.py index 4b505c1b4dd..1c5b946b54b 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_not_response_body_for_content_types/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_not_response_body_for_content_types/test_post.py @@ -32,6 +32,7 @@ def tearDown(self): pass response_status = 200 + response_body_schema = post.response_for_200.BodySchemas.application_json def test_allowed_passes(self): # allowed @@ -56,8 +57,8 @@ def test_allowed_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_nul_characters_in_strings_response_body_for_content_types/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_nul_characters_in_strings_response_body_for_content_types/test_post.py index b0ce13a519c..774d3680059 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_nul_characters_in_strings_response_body_for_content_types/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_nul_characters_in_strings_response_body_for_content_types/test_post.py @@ -32,6 +32,7 @@ def tearDown(self): pass response_status = 200 + response_body_schema = post.response_for_200.BodySchemas.application_json def test_match_string_with_nul_passes(self): # match string with nul @@ -56,8 +57,8 @@ def test_match_string_with_nul_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_null_type_matches_only_the_null_object_response_body_for_content_types/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_null_type_matches_only_the_null_object_response_body_for_content_types/test_post.py index 39685609338..f49416cf51c 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_null_type_matches_only_the_null_object_response_body_for_content_types/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_null_type_matches_only_the_null_object_response_body_for_content_types/test_post.py @@ -32,6 +32,7 @@ def tearDown(self): pass response_status = 200 + response_body_schema = post.response_for_200.BodySchemas.application_json def test_a_float_is_not_null_fails(self): # a float is not null @@ -225,8 +226,8 @@ def test_null_is_null_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_number_type_matches_numbers_response_body_for_content_types/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_number_type_matches_numbers_response_body_for_content_types/test_post.py index aa54a7620bc..003a3f1f77b 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_number_type_matches_numbers_response_body_for_content_types/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_number_type_matches_numbers_response_body_for_content_types/test_post.py @@ -32,6 +32,7 @@ def tearDown(self): pass response_status = 200 + response_body_schema = post.response_for_200.BodySchemas.application_json def test_an_array_is_not_a_number_fails(self): # an array is not a number @@ -154,8 +155,8 @@ def test_a_float_is_a_number_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -232,8 +233,8 @@ def test_an_integer_is_a_number_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -262,8 +263,8 @@ def test_a_float_with_zero_fractional_part_is_a_number_and_an_integer_passes(sel ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_object_properties_validation_response_body_for_content_types/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_object_properties_validation_response_body_for_content_types/test_post.py index 28b78c68162..02ac356e196 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_object_properties_validation_response_body_for_content_types/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_object_properties_validation_response_body_for_content_types/test_post.py @@ -32,6 +32,7 @@ def tearDown(self): pass response_status = 200 + response_body_schema = post.response_for_200.BodySchemas.application_json def test_ignores_arrays_passes(self): # ignores arrays @@ -57,8 +58,8 @@ def test_ignores_arrays_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -87,8 +88,8 @@ def test_ignores_other_non_objects_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -152,8 +153,8 @@ def test_both_properties_present_and_valid_is_valid_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -186,8 +187,8 @@ def test_doesn_t_invalidate_other_properties_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_object_type_matches_objects_response_body_for_content_types/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_object_type_matches_objects_response_body_for_content_types/test_post.py index 55da20de7ef..d0b6aecf657 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_object_type_matches_objects_response_body_for_content_types/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_object_type_matches_objects_response_body_for_content_types/test_post.py @@ -32,6 +32,7 @@ def tearDown(self): pass response_status = 200 + response_body_schema = post.response_for_200.BodySchemas.application_json def test_a_float_is_not_an_object_fails(self): # a float is not an object @@ -130,8 +131,8 @@ def test_an_object_is_an_object_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_oneof_complex_types_response_body_for_content_types/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_oneof_complex_types_response_body_for_content_types/test_post.py index 678c4ad8098..f17f61a9666 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_oneof_complex_types_response_body_for_content_types/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_oneof_complex_types_response_body_for_content_types/test_post.py @@ -32,6 +32,7 @@ def tearDown(self): pass response_status = 200 + response_body_schema = post.response_for_200.BodySchemas.application_json def test_first_oneof_valid_complex_passes(self): # first oneOf valid (complex) @@ -59,8 +60,8 @@ def test_first_oneof_valid_complex_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -150,8 +151,8 @@ def test_second_oneof_valid_complex_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_oneof_response_body_for_content_types/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_oneof_response_body_for_content_types/test_post.py index ea487855ed5..41307c7f9aa 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_oneof_response_body_for_content_types/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_oneof_response_body_for_content_types/test_post.py @@ -32,6 +32,7 @@ def tearDown(self): pass response_status = 200 + response_body_schema = post.response_for_200.BodySchemas.application_json def test_second_oneof_valid_passes(self): # second oneOf valid @@ -56,8 +57,8 @@ def test_second_oneof_valid_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -110,8 +111,8 @@ def test_first_oneof_valid_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_oneof_with_base_schema_response_body_for_content_types/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_oneof_with_base_schema_response_body_for_content_types/test_post.py index cfe0200c089..705c43974eb 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_oneof_with_base_schema_response_body_for_content_types/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_oneof_with_base_schema_response_body_for_content_types/test_post.py @@ -32,6 +32,7 @@ def tearDown(self): pass response_status = 200 + response_body_schema = post.response_for_200.BodySchemas.application_json def test_both_oneof_valid_fails(self): # both oneOf valid @@ -104,8 +105,8 @@ def test_one_oneof_valid_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_oneof_with_empty_schema_response_body_for_content_types/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_oneof_with_empty_schema_response_body_for_content_types/test_post.py index 471fdae40c1..ddbec0e45c5 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_oneof_with_empty_schema_response_body_for_content_types/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_oneof_with_empty_schema_response_body_for_content_types/test_post.py @@ -32,6 +32,7 @@ def tearDown(self): pass response_status = 200 + response_body_schema = post.response_for_200.BodySchemas.application_json def test_both_valid_invalid_fails(self): # both valid - invalid @@ -80,8 +81,8 @@ def test_one_valid_valid_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_oneof_with_required_response_body_for_content_types/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_oneof_with_required_response_body_for_content_types/test_post.py index dca5c2b9194..43d4762f15a 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_oneof_with_required_response_body_for_content_types/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_oneof_with_required_response_body_for_content_types/test_post.py @@ -32,6 +32,7 @@ def tearDown(self): pass response_status = 200 + response_body_schema = post.response_for_200.BodySchemas.application_json def test_both_valid_invalid_fails(self): # both valid - invalid @@ -119,8 +120,8 @@ def test_first_valid_valid_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -154,8 +155,8 @@ def test_second_valid_valid_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_pattern_is_not_anchored_response_body_for_content_types/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_pattern_is_not_anchored_response_body_for_content_types/test_post.py index 245619a9482..6c02d17b75e 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_pattern_is_not_anchored_response_body_for_content_types/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_pattern_is_not_anchored_response_body_for_content_types/test_post.py @@ -32,6 +32,7 @@ def tearDown(self): pass response_status = 200 + response_body_schema = post.response_for_200.BodySchemas.application_json def test_matches_a_substring_passes(self): # matches a substring @@ -56,8 +57,8 @@ def test_matches_a_substring_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_pattern_validation_response_body_for_content_types/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_pattern_validation_response_body_for_content_types/test_post.py index 15e3b6dc969..c751494920a 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_pattern_validation_response_body_for_content_types/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_pattern_validation_response_body_for_content_types/test_post.py @@ -32,6 +32,7 @@ def tearDown(self): pass response_status = 200 + response_body_schema = post.response_for_200.BodySchemas.application_json def test_ignores_arrays_passes(self): # ignores arrays @@ -57,8 +58,8 @@ def test_ignores_arrays_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -88,8 +89,8 @@ def test_ignores_objects_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -118,8 +119,8 @@ def test_ignores_null_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -148,8 +149,8 @@ def test_ignores_floats_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -202,8 +203,8 @@ def test_ignores_booleans_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -232,8 +233,8 @@ def test_a_matching_pattern_is_valid_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -262,8 +263,8 @@ def test_ignores_integers_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_properties_with_escaped_characters_response_body_for_content_types/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_properties_with_escaped_characters_response_body_for_content_types/test_post.py index d3104eca246..85a89181cba 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_properties_with_escaped_characters_response_body_for_content_types/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_properties_with_escaped_characters_response_body_for_content_types/test_post.py @@ -32,6 +32,7 @@ def tearDown(self): pass response_status = 200 + response_body_schema = post.response_for_200.BodySchemas.application_json def test_object_with_all_numbers_is_valid_passes(self): # object with all numbers is valid @@ -69,8 +70,8 @@ def test_object_with_all_numbers_is_valid_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_property_named_ref_that_is_not_a_reference_response_body_for_content_types/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_property_named_ref_that_is_not_a_reference_response_body_for_content_types/test_post.py index 15809e33dbe..3ef85297cee 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_property_named_ref_that_is_not_a_reference_response_body_for_content_types/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_property_named_ref_that_is_not_a_reference_response_body_for_content_types/test_post.py @@ -32,6 +32,7 @@ def tearDown(self): pass response_status = 200 + response_body_schema = post.response_for_200.BodySchemas.application_json def test_property_named_ref_valid_passes(self): # property named $ref valid @@ -59,8 +60,8 @@ def test_property_named_ref_valid_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_ref_in_additionalproperties_response_body_for_content_types/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_ref_in_additionalproperties_response_body_for_content_types/test_post.py index 00e6305e31d..1009dd2bd53 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_ref_in_additionalproperties_response_body_for_content_types/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_ref_in_additionalproperties_response_body_for_content_types/test_post.py @@ -32,6 +32,7 @@ def tearDown(self): pass response_status = 200 + response_body_schema = post.response_for_200.BodySchemas.application_json def test_property_named_ref_valid_passes(self): # property named $ref valid @@ -62,8 +63,8 @@ def test_property_named_ref_valid_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_ref_in_allof_response_body_for_content_types/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_ref_in_allof_response_body_for_content_types/test_post.py index 02b7a73a40d..3d846893ba2 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_ref_in_allof_response_body_for_content_types/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_ref_in_allof_response_body_for_content_types/test_post.py @@ -32,6 +32,7 @@ def tearDown(self): pass response_status = 200 + response_body_schema = post.response_for_200.BodySchemas.application_json def test_property_named_ref_valid_passes(self): # property named $ref valid @@ -59,8 +60,8 @@ def test_property_named_ref_valid_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_ref_in_anyof_response_body_for_content_types/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_ref_in_anyof_response_body_for_content_types/test_post.py index 5094e0cc1c3..2111d46068d 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_ref_in_anyof_response_body_for_content_types/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_ref_in_anyof_response_body_for_content_types/test_post.py @@ -32,6 +32,7 @@ def tearDown(self): pass response_status = 200 + response_body_schema = post.response_for_200.BodySchemas.application_json def test_property_named_ref_valid_passes(self): # property named $ref valid @@ -59,8 +60,8 @@ def test_property_named_ref_valid_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_ref_in_items_response_body_for_content_types/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_ref_in_items_response_body_for_content_types/test_post.py index 73d211de567..a42e9ff123b 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_ref_in_items_response_body_for_content_types/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_ref_in_items_response_body_for_content_types/test_post.py @@ -32,6 +32,7 @@ def tearDown(self): pass response_status = 200 + response_body_schema = post.response_for_200.BodySchemas.application_json def test_property_named_ref_valid_passes(self): # property named $ref valid @@ -61,8 +62,8 @@ def test_property_named_ref_valid_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_ref_in_not_response_body_for_content_types/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_ref_in_not_response_body_for_content_types/test_post.py index fa87d826404..1cda687b68c 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_ref_in_not_response_body_for_content_types/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_ref_in_not_response_body_for_content_types/test_post.py @@ -32,6 +32,7 @@ def tearDown(self): pass response_status = 200 + response_body_schema = post.response_for_200.BodySchemas.application_json def test_property_named_ref_valid_passes(self): # property named $ref valid @@ -59,8 +60,8 @@ def test_property_named_ref_valid_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_ref_in_oneof_response_body_for_content_types/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_ref_in_oneof_response_body_for_content_types/test_post.py index 50be3af9dc6..b258dc1c5e2 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_ref_in_oneof_response_body_for_content_types/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_ref_in_oneof_response_body_for_content_types/test_post.py @@ -32,6 +32,7 @@ def tearDown(self): pass response_status = 200 + response_body_schema = post.response_for_200.BodySchemas.application_json def test_property_named_ref_valid_passes(self): # property named $ref valid @@ -59,8 +60,8 @@ def test_property_named_ref_valid_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_ref_in_property_response_body_for_content_types/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_ref_in_property_response_body_for_content_types/test_post.py index 3d93977c2bc..93611ac5749 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_ref_in_property_response_body_for_content_types/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_ref_in_property_response_body_for_content_types/test_post.py @@ -32,6 +32,7 @@ def tearDown(self): pass response_status = 200 + response_body_schema = post.response_for_200.BodySchemas.application_json def test_property_named_ref_valid_passes(self): # property named $ref valid @@ -62,8 +63,8 @@ def test_property_named_ref_valid_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_required_default_validation_response_body_for_content_types/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_required_default_validation_response_body_for_content_types/test_post.py index c7978bfe4bc..f9a6f103091 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_required_default_validation_response_body_for_content_types/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_required_default_validation_response_body_for_content_types/test_post.py @@ -32,6 +32,7 @@ def tearDown(self): pass response_status = 200 + response_body_schema = post.response_for_200.BodySchemas.application_json def test_not_required_by_default_passes(self): # not required by default @@ -57,8 +58,8 @@ def test_not_required_by_default_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_required_validation_response_body_for_content_types/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_required_validation_response_body_for_content_types/test_post.py index e3c20b581ce..02b8623d972 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_required_validation_response_body_for_content_types/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_required_validation_response_body_for_content_types/test_post.py @@ -32,6 +32,7 @@ def tearDown(self): pass response_status = 200 + response_body_schema = post.response_for_200.BodySchemas.application_json def test_ignores_arrays_passes(self): # ignores arrays @@ -57,8 +58,8 @@ def test_ignores_arrays_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -90,8 +91,8 @@ def test_present_required_property_is_valid_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -120,8 +121,8 @@ def test_ignores_other_non_objects_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -150,8 +151,8 @@ def test_ignores_strings_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_required_with_empty_array_response_body_for_content_types/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_required_with_empty_array_response_body_for_content_types/test_post.py index 2e220a6fccf..1db0f9b7e3f 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_required_with_empty_array_response_body_for_content_types/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_required_with_empty_array_response_body_for_content_types/test_post.py @@ -32,6 +32,7 @@ def tearDown(self): pass response_status = 200 + response_body_schema = post.response_for_200.BodySchemas.application_json def test_property_not_required_passes(self): # property not required @@ -57,8 +58,8 @@ def test_property_not_required_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_required_with_escaped_characters_response_body_for_content_types/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_required_with_escaped_characters_response_body_for_content_types/test_post.py index 921a4c2923c..3461faf2245 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_required_with_escaped_characters_response_body_for_content_types/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_required_with_escaped_characters_response_body_for_content_types/test_post.py @@ -32,6 +32,7 @@ def tearDown(self): pass response_status = 200 + response_body_schema = post.response_for_200.BodySchemas.application_json def test_object_with_some_properties_missing_is_invalid_fails(self): # object with some properties missing is invalid @@ -98,8 +99,8 @@ def test_object_with_all_properties_present_is_valid_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_simple_enum_validation_response_body_for_content_types/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_simple_enum_validation_response_body_for_content_types/test_post.py index abadbf18cb1..b8c6ad6b4bd 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_simple_enum_validation_response_body_for_content_types/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_simple_enum_validation_response_body_for_content_types/test_post.py @@ -32,6 +32,7 @@ def tearDown(self): pass response_status = 200 + response_body_schema = post.response_for_200.BodySchemas.application_json def test_something_else_is_invalid_fails(self): # something else is invalid @@ -80,8 +81,8 @@ def test_one_of_the_enum_is_valid_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_string_type_matches_strings_response_body_for_content_types/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_string_type_matches_strings_response_body_for_content_types/test_post.py index e1a0a1dd840..f2745640089 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_string_type_matches_strings_response_body_for_content_types/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_string_type_matches_strings_response_body_for_content_types/test_post.py @@ -32,6 +32,7 @@ def tearDown(self): pass response_status = 200 + response_body_schema = post.response_for_200.BodySchemas.application_json def test_1_is_not_a_string_fails(self): # 1 is not a string @@ -80,8 +81,8 @@ def test_a_string_is_still_a_string_even_if_it_looks_like_a_number_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -110,8 +111,8 @@ def test_an_empty_string_is_still_a_string_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -262,8 +263,8 @@ def test_a_string_is_a_string_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_response_body_for_content_types/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_response_body_for_content_types/test_post.py index c729358716d..984c28c06ad 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_response_body_for_content_types/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_response_body_for_content_types/test_post.py @@ -32,6 +32,7 @@ def tearDown(self): pass response_status = 200 + response_body_schema = post.response_for_200.BodySchemas.application_json def test_missing_properties_are_not_filled_in_with_the_default_passes(self): # missing properties are not filled in with the default @@ -57,8 +58,8 @@ def test_missing_properties_are_not_filled_in_with_the_default_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -90,8 +91,8 @@ def test_an_explicit_property_value_is_checked_against_maximum_passing_passes(se ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_uniqueitems_false_validation_response_body_for_content_types/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_uniqueitems_false_validation_response_body_for_content_types/test_post.py index f78f2961df8..b87dd6e5089 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_uniqueitems_false_validation_response_body_for_content_types/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_uniqueitems_false_validation_response_body_for_content_types/test_post.py @@ -32,6 +32,7 @@ def tearDown(self): pass response_status = 200 + response_body_schema = post.response_for_200.BodySchemas.application_json def test_non_unique_array_of_integers_is_valid_passes(self): # non-unique array of integers is valid @@ -59,8 +60,8 @@ def test_non_unique_array_of_integers_is_valid_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -98,8 +99,8 @@ def test_unique_array_of_objects_is_valid_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -149,8 +150,8 @@ def test_non_unique_array_of_nested_objects_is_valid_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -188,8 +189,8 @@ def test_non_unique_array_of_objects_is_valid_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -221,8 +222,8 @@ def test_1_and_true_are_unique_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -254,8 +255,8 @@ def test_unique_array_of_integers_is_valid_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -291,8 +292,8 @@ def test_non_unique_array_of_arrays_is_valid_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -325,8 +326,8 @@ def test_numbers_are_unique_if_mathematically_unequal_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -358,8 +359,8 @@ def test_false_is_not_equal_to_zero_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -409,8 +410,8 @@ def test_unique_array_of_nested_objects_is_valid_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -442,8 +443,8 @@ def test_0_and_false_are_unique_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -479,8 +480,8 @@ def test_unique_array_of_arrays_is_valid_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -512,8 +513,8 @@ def test_true_is_not_equal_to_one_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -553,8 +554,8 @@ def test_non_unique_heterogeneous_types_are_valid_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -592,8 +593,8 @@ def test_unique_heterogeneous_types_are_valid_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_uniqueitems_validation_response_body_for_content_types/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_uniqueitems_validation_response_body_for_content_types/test_post.py index f7a88f24b26..9a77c3fa72d 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_uniqueitems_validation_response_body_for_content_types/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_uniqueitems_validation_response_body_for_content_types/test_post.py @@ -32,6 +32,7 @@ def tearDown(self): pass response_status = 200 + response_body_schema = post.response_for_200.BodySchemas.application_json def test_unique_array_of_objects_is_valid_passes(self): # unique array of objects is valid @@ -65,8 +66,8 @@ def test_unique_array_of_objects_is_valid_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -104,8 +105,8 @@ def test_a_true_and_a1_are_unique_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -182,8 +183,8 @@ def test_nested0_and_false_are_unique_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -221,8 +222,8 @@ def test_a_false_and_a0_are_unique_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -282,8 +283,8 @@ def test_false_is_not_equal_to_zero_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -319,8 +320,8 @@ def test_0_and_false_are_unique_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -356,8 +357,8 @@ def test_unique_array_of_arrays_is_valid_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -462,8 +463,8 @@ def test_true_is_not_equal_to_one_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -533,8 +534,8 @@ def test_unique_array_of_strings_is_valid_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -570,8 +571,8 @@ def test_1_and_true_are_unique_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -613,8 +614,8 @@ def test_different_objects_are_unique_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -646,8 +647,8 @@ def test_unique_array_of_integers_is_valid_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -764,8 +765,8 @@ def test_unique_array_of_nested_objects_is_valid_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -866,8 +867,8 @@ def test_nested1_and_true_are_unique_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -906,8 +907,8 @@ def test_unique_heterogeneous_types_are_valid_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_uri_format_response_body_for_content_types/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_uri_format_response_body_for_content_types/test_post.py index 2c93b63f9e8..945d168fe9b 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_uri_format_response_body_for_content_types/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_uri_format_response_body_for_content_types/test_post.py @@ -32,6 +32,7 @@ def tearDown(self): pass response_status = 200 + response_body_schema = post.response_for_200.BodySchemas.application_json def test_all_string_formats_ignore_objects_passes(self): # all string formats ignore objects @@ -57,8 +58,8 @@ def test_all_string_formats_ignore_objects_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -87,8 +88,8 @@ def test_all_string_formats_ignore_booleans_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -117,8 +118,8 @@ def test_all_string_formats_ignore_integers_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -147,8 +148,8 @@ def test_all_string_formats_ignore_floats_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -178,8 +179,8 @@ def test_all_string_formats_ignore_arrays_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -208,8 +209,8 @@ def test_all_string_formats_ignore_nulls_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_uri_reference_format_response_body_for_content_types/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_uri_reference_format_response_body_for_content_types/test_post.py index 6fa62462b50..a86837a48c5 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_uri_reference_format_response_body_for_content_types/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_uri_reference_format_response_body_for_content_types/test_post.py @@ -32,6 +32,7 @@ def tearDown(self): pass response_status = 200 + response_body_schema = post.response_for_200.BodySchemas.application_json def test_all_string_formats_ignore_objects_passes(self): # all string formats ignore objects @@ -57,8 +58,8 @@ def test_all_string_formats_ignore_objects_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -87,8 +88,8 @@ def test_all_string_formats_ignore_booleans_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -117,8 +118,8 @@ def test_all_string_formats_ignore_integers_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -147,8 +148,8 @@ def test_all_string_formats_ignore_floats_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -178,8 +179,8 @@ def test_all_string_formats_ignore_arrays_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -208,8 +209,8 @@ def test_all_string_formats_ignore_nulls_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_uri_template_format_response_body_for_content_types/test_post.py b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_uri_template_format_response_body_for_content_types/test_post.py index 3a57d51e1ae..89c2df2e94a 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_uri_template_format_response_body_for_content_types/test_post.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/test/test_paths/test_response_body_post_uri_template_format_response_body_for_content_types/test_post.py @@ -32,6 +32,7 @@ def tearDown(self): pass response_status = 200 + response_body_schema = post.response_for_200.BodySchemas.application_json def test_all_string_formats_ignore_objects_passes(self): # all string formats ignore objects @@ -57,8 +58,8 @@ def test_all_string_formats_ignore_objects_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -87,8 +88,8 @@ def test_all_string_formats_ignore_booleans_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -117,8 +118,8 @@ def test_all_string_formats_ignore_integers_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -147,8 +148,8 @@ def test_all_string_formats_ignore_floats_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -178,8 +179,8 @@ def test_all_string_formats_ignore_arrays_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) @@ -208,8 +209,8 @@ def test_all_string_formats_ignore_nulls_passes(self): ) assert isinstance(api_response.response, urllib3.HTTPResponse) - assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson) - deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson.from_openapi_data_oapg( + assert isinstance(api_response.body, self.response_body_schema) + deserialized_response_body = self.response_body_schema.from_openapi_data_oapg( payload, _configuration=self._configuration ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/api_client.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/api_client.py index 6fa884fc7d8..091ebaae480 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/api_client.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/api_client.py @@ -8,7 +8,7 @@ Generated by: https://openapi-generator.tech """ -from dataclasses import dataclass +import dataclasses from decimal import Decimal import enum import email @@ -343,7 +343,7 @@ def _content_type_is_json(cls, content_type: str) -> bool: return False -@dataclass +@dataclasses.dataclass class ParameterBase(JSONDetector): name: str in_type: ParameterInType @@ -783,7 +783,7 @@ def __init__( self.allow_reserved = allow_reserved -@dataclass +@dataclasses.dataclass class MediaType: """ Used to store request and response body schema information @@ -797,7 +797,7 @@ class MediaType: encoding: typing.Optional[typing.Dict[str, Encoding]] = None -@dataclass +@dataclasses.dataclass class ApiResponse: response: urllib3.HTTPResponse body: typing.Union[Unset, Schema] @@ -806,8 +806,8 @@ class ApiResponse: def __init__( self, response: urllib3.HTTPResponse, - body: typing.Union[Unset, typing.Type[Schema]], - headers: typing.Union[Unset, typing.List[HeaderParameter]] + body: typing.Union[Unset, typing.Type[Schema]] = unset, + headers: typing.Union[Unset, typing.List[HeaderParameter]] = unset ): """ pycharm needs this to prevent 'Unexpected argument' warnings @@ -817,7 +817,7 @@ def __init__( self.headers = headers -@dataclass +@dataclasses.dataclass class ApiResponseWithoutDeserialization(ApiResponse): response: urllib3.HTTPResponse body: typing.Union[Unset, typing.Type[Schema]] = unset diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/model/object_type_matches_objects.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/model/object_type_matches_objects.py new file mode 100644 index 00000000000..a7c70ef5648 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/model/object_type_matches_objects.py @@ -0,0 +1,24 @@ +# coding: utf-8 + +""" + openapi 3.0.3 sample spec + + sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501 + + The version of the OpenAPI document: 0.0.1 + Generated by: https://openapi-generator.tech +""" + +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 +ObjectTypeMatchesObjects = schemas.DictSchema diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/model/object_type_matches_objects.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/model/object_type_matches_objects.pyi new file mode 100644 index 00000000000..a7c70ef5648 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/model/object_type_matches_objects.pyi @@ -0,0 +1,24 @@ +# coding: utf-8 + +""" + openapi 3.0.3 sample spec + + sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501 + + The version of the OpenAPI document: 0.0.1 + Generated by: https://openapi-generator.tech +""" + +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 +ObjectTypeMatchesObjects = schemas.DictSchema diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/models/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/models/__init__.py index 3dd512a4cd2..df0bd23b6d5 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/models/__init__.py +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/models/__init__.py @@ -69,6 +69,7 @@ from unit_test_api.model.null_type_matches_only_the_null_object import NullTypeMatchesOnlyTheNullObject from unit_test_api.model.number_type_matches_numbers import NumberTypeMatchesNumbers from unit_test_api.model.object_properties_validation import ObjectPropertiesValidation +from unit_test_api.model.object_type_matches_objects import ObjectTypeMatchesObjects from unit_test_api.model.oneof import Oneof from unit_test_api.model.oneof_complex_types import OneofComplexTypes from unit_test_api.model.oneof_with_base_schema import OneofWithBaseSchema diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_additionalproperties_allows_a_schema_which_should_validate_request_body/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_additionalproperties_allows_a_schema_which_should_validate_request_body/post.py deleted file mode 100644 index 51f747166d0..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_additionalproperties_allows_a_schema_which_should_validate_request_body/post.py +++ /dev/null @@ -1,298 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.additionalproperties_allows_a_schema_which_should_validate import AdditionalpropertiesAllowsASchemaWhichShouldValidate - -from . import path - -# body param -SchemaForRequestBodyApplicationJson = AdditionalpropertiesAllowsASchemaWhichShouldValidate - - -request_body_additionalproperties_allows_a_schema_which_should_validate = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) -_status_code_to_response = { - '200': _response_for_200, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _post_additionalproperties_allows_a_schema_which_should_validate_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_additionalproperties_allows_a_schema_which_should_validate_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_additionalproperties_allows_a_schema_which_should_validate_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_additionalproperties_allows_a_schema_which_should_validate_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_additionalproperties_allows_a_schema_which_should_validate_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_additionalproperties_allows_a_schema_which_should_validate.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostAdditionalpropertiesAllowsASchemaWhichShouldValidateRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_additionalproperties_allows_a_schema_which_should_validate_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_additionalproperties_allows_a_schema_which_should_validate_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_additionalproperties_allows_a_schema_which_should_validate_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_additionalproperties_allows_a_schema_which_should_validate_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_additionalproperties_allows_a_schema_which_should_validate_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_additionalproperties_allows_a_schema_which_should_validate_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_additionalproperties_allows_a_schema_which_should_validate_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_additionalproperties_allows_a_schema_which_should_validate_request_body/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_additionalproperties_allows_a_schema_which_should_validate_request_body/post.pyi deleted file mode 100644 index fb323cc1c83..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_additionalproperties_allows_a_schema_which_should_validate_request_body/post.pyi +++ /dev/null @@ -1,293 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.additionalproperties_allows_a_schema_which_should_validate import AdditionalpropertiesAllowsASchemaWhichShouldValidate - -# body param -SchemaForRequestBodyApplicationJson = AdditionalpropertiesAllowsASchemaWhichShouldValidate - - -request_body_additionalproperties_allows_a_schema_which_should_validate = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_additionalproperties_allows_a_schema_which_should_validate_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_additionalproperties_allows_a_schema_which_should_validate_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_additionalproperties_allows_a_schema_which_should_validate_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_additionalproperties_allows_a_schema_which_should_validate_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_additionalproperties_allows_a_schema_which_should_validate_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_additionalproperties_allows_a_schema_which_should_validate.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostAdditionalpropertiesAllowsASchemaWhichShouldValidateRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_additionalproperties_allows_a_schema_which_should_validate_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_additionalproperties_allows_a_schema_which_should_validate_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_additionalproperties_allows_a_schema_which_should_validate_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_additionalproperties_allows_a_schema_which_should_validate_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_additionalproperties_allows_a_schema_which_should_validate_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_additionalproperties_allows_a_schema_which_should_validate_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_additionalproperties_allows_a_schema_which_should_validate_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_additionalproperties_allows_a_schema_which_should_validate_request_body/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_additionalproperties_allows_a_schema_which_should_validate_request_body/post/__init__.py new file mode 100644 index 00000000000..37a60571dd9 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_additionalproperties_allows_a_schema_which_should_validate_request_body/post/__init__.py @@ -0,0 +1,291 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.additionalproperties_allows_a_schema_which_should_validate import AdditionalpropertiesAllowsASchemaWhichShouldValidate + +from .. import path +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = AdditionalpropertiesAllowsASchemaWhichShouldValidate + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + +_status_code_to_response = { + '200': response_for_200.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _post_additionalproperties_allows_a_schema_which_should_validate_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_additionalproperties_allows_a_schema_which_should_validate_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_additionalproperties_allows_a_schema_which_should_validate_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_additionalproperties_allows_a_schema_which_should_validate_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_additionalproperties_allows_a_schema_which_should_validate_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostAdditionalpropertiesAllowsASchemaWhichShouldValidateRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_additionalproperties_allows_a_schema_which_should_validate_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_additionalproperties_allows_a_schema_which_should_validate_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_additionalproperties_allows_a_schema_which_should_validate_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_additionalproperties_allows_a_schema_which_should_validate_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_additionalproperties_allows_a_schema_which_should_validate_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_additionalproperties_allows_a_schema_which_should_validate_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_additionalproperties_allows_a_schema_which_should_validate_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_additionalproperties_allows_a_schema_which_should_validate_request_body/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_additionalproperties_allows_a_schema_which_should_validate_request_body/post/__init__.pyi new file mode 100644 index 00000000000..4df9200d050 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_additionalproperties_allows_a_schema_which_should_validate_request_body/post/__init__.pyi @@ -0,0 +1,286 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.additionalproperties_allows_a_schema_which_should_validate import AdditionalpropertiesAllowsASchemaWhichShouldValidate + +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = AdditionalpropertiesAllowsASchemaWhichShouldValidate + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_additionalproperties_allows_a_schema_which_should_validate_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_additionalproperties_allows_a_schema_which_should_validate_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_additionalproperties_allows_a_schema_which_should_validate_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_additionalproperties_allows_a_schema_which_should_validate_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_additionalproperties_allows_a_schema_which_should_validate_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostAdditionalpropertiesAllowsASchemaWhichShouldValidateRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_additionalproperties_allows_a_schema_which_should_validate_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_additionalproperties_allows_a_schema_which_should_validate_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_additionalproperties_allows_a_schema_which_should_validate_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_additionalproperties_allows_a_schema_which_should_validate_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_additionalproperties_allows_a_schema_which_should_validate_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_additionalproperties_allows_a_schema_which_should_validate_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_additionalproperties_allows_a_schema_which_should_validate_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_additionalproperties_allows_a_schema_which_should_validate_request_body/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_additionalproperties_allows_a_schema_which_should_validate_request_body/post/response_for_200.py new file mode 100644 index 00000000000..ce057133be3 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_additionalproperties_allows_a_schema_which_should_validate_request_body/post/response_for_200.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_additionalproperties_are_allowed_by_default_request_body/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_additionalproperties_are_allowed_by_default_request_body/post.py deleted file mode 100644 index 7be02743e60..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_additionalproperties_are_allowed_by_default_request_body/post.py +++ /dev/null @@ -1,298 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.additionalproperties_are_allowed_by_default import AdditionalpropertiesAreAllowedByDefault - -from . import path - -# body param -SchemaForRequestBodyApplicationJson = AdditionalpropertiesAreAllowedByDefault - - -request_body_additionalproperties_are_allowed_by_default = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) -_status_code_to_response = { - '200': _response_for_200, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _post_additionalproperties_are_allowed_by_default_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_additionalproperties_are_allowed_by_default_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_additionalproperties_are_allowed_by_default_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_additionalproperties_are_allowed_by_default_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_additionalproperties_are_allowed_by_default_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_additionalproperties_are_allowed_by_default.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostAdditionalpropertiesAreAllowedByDefaultRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_additionalproperties_are_allowed_by_default_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_additionalproperties_are_allowed_by_default_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_additionalproperties_are_allowed_by_default_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_additionalproperties_are_allowed_by_default_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_additionalproperties_are_allowed_by_default_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_additionalproperties_are_allowed_by_default_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_additionalproperties_are_allowed_by_default_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_additionalproperties_are_allowed_by_default_request_body/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_additionalproperties_are_allowed_by_default_request_body/post.pyi deleted file mode 100644 index 8155ff2963b..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_additionalproperties_are_allowed_by_default_request_body/post.pyi +++ /dev/null @@ -1,293 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.additionalproperties_are_allowed_by_default import AdditionalpropertiesAreAllowedByDefault - -# body param -SchemaForRequestBodyApplicationJson = AdditionalpropertiesAreAllowedByDefault - - -request_body_additionalproperties_are_allowed_by_default = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_additionalproperties_are_allowed_by_default_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_additionalproperties_are_allowed_by_default_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_additionalproperties_are_allowed_by_default_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_additionalproperties_are_allowed_by_default_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_additionalproperties_are_allowed_by_default_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_additionalproperties_are_allowed_by_default.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostAdditionalpropertiesAreAllowedByDefaultRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_additionalproperties_are_allowed_by_default_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_additionalproperties_are_allowed_by_default_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_additionalproperties_are_allowed_by_default_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_additionalproperties_are_allowed_by_default_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_additionalproperties_are_allowed_by_default_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_additionalproperties_are_allowed_by_default_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_additionalproperties_are_allowed_by_default_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_additionalproperties_are_allowed_by_default_request_body/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_additionalproperties_are_allowed_by_default_request_body/post/__init__.py new file mode 100644 index 00000000000..86cc478b99b --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_additionalproperties_are_allowed_by_default_request_body/post/__init__.py @@ -0,0 +1,291 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.additionalproperties_are_allowed_by_default import AdditionalpropertiesAreAllowedByDefault + +from .. import path +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = AdditionalpropertiesAreAllowedByDefault + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + +_status_code_to_response = { + '200': response_for_200.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _post_additionalproperties_are_allowed_by_default_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_additionalproperties_are_allowed_by_default_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_additionalproperties_are_allowed_by_default_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_additionalproperties_are_allowed_by_default_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_additionalproperties_are_allowed_by_default_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostAdditionalpropertiesAreAllowedByDefaultRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_additionalproperties_are_allowed_by_default_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_additionalproperties_are_allowed_by_default_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_additionalproperties_are_allowed_by_default_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_additionalproperties_are_allowed_by_default_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_additionalproperties_are_allowed_by_default_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_additionalproperties_are_allowed_by_default_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_additionalproperties_are_allowed_by_default_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_additionalproperties_are_allowed_by_default_request_body/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_additionalproperties_are_allowed_by_default_request_body/post/__init__.pyi new file mode 100644 index 00000000000..c3e1dfde555 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_additionalproperties_are_allowed_by_default_request_body/post/__init__.pyi @@ -0,0 +1,286 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.additionalproperties_are_allowed_by_default import AdditionalpropertiesAreAllowedByDefault + +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = AdditionalpropertiesAreAllowedByDefault + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_additionalproperties_are_allowed_by_default_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_additionalproperties_are_allowed_by_default_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_additionalproperties_are_allowed_by_default_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_additionalproperties_are_allowed_by_default_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_additionalproperties_are_allowed_by_default_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostAdditionalpropertiesAreAllowedByDefaultRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_additionalproperties_are_allowed_by_default_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_additionalproperties_are_allowed_by_default_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_additionalproperties_are_allowed_by_default_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_additionalproperties_are_allowed_by_default_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_additionalproperties_are_allowed_by_default_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_additionalproperties_are_allowed_by_default_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_additionalproperties_are_allowed_by_default_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_additionalproperties_are_allowed_by_default_request_body/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_additionalproperties_are_allowed_by_default_request_body/post/response_for_200.py new file mode 100644 index 00000000000..ce057133be3 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_additionalproperties_are_allowed_by_default_request_body/post/response_for_200.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_additionalproperties_can_exist_by_itself_request_body/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_additionalproperties_can_exist_by_itself_request_body/post.py deleted file mode 100644 index f561016356e..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_additionalproperties_can_exist_by_itself_request_body/post.py +++ /dev/null @@ -1,298 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.additionalproperties_can_exist_by_itself import AdditionalpropertiesCanExistByItself - -from . import path - -# body param -SchemaForRequestBodyApplicationJson = AdditionalpropertiesCanExistByItself - - -request_body_additionalproperties_can_exist_by_itself = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) -_status_code_to_response = { - '200': _response_for_200, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _post_additionalproperties_can_exist_by_itself_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_additionalproperties_can_exist_by_itself_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_additionalproperties_can_exist_by_itself_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_additionalproperties_can_exist_by_itself_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_additionalproperties_can_exist_by_itself_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_additionalproperties_can_exist_by_itself.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostAdditionalpropertiesCanExistByItselfRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_additionalproperties_can_exist_by_itself_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_additionalproperties_can_exist_by_itself_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_additionalproperties_can_exist_by_itself_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_additionalproperties_can_exist_by_itself_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_additionalproperties_can_exist_by_itself_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_additionalproperties_can_exist_by_itself_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_additionalproperties_can_exist_by_itself_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_additionalproperties_can_exist_by_itself_request_body/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_additionalproperties_can_exist_by_itself_request_body/post.pyi deleted file mode 100644 index 6ba0464fbda..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_additionalproperties_can_exist_by_itself_request_body/post.pyi +++ /dev/null @@ -1,293 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.additionalproperties_can_exist_by_itself import AdditionalpropertiesCanExistByItself - -# body param -SchemaForRequestBodyApplicationJson = AdditionalpropertiesCanExistByItself - - -request_body_additionalproperties_can_exist_by_itself = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_additionalproperties_can_exist_by_itself_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_additionalproperties_can_exist_by_itself_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_additionalproperties_can_exist_by_itself_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_additionalproperties_can_exist_by_itself_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_additionalproperties_can_exist_by_itself_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_additionalproperties_can_exist_by_itself.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostAdditionalpropertiesCanExistByItselfRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_additionalproperties_can_exist_by_itself_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_additionalproperties_can_exist_by_itself_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_additionalproperties_can_exist_by_itself_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_additionalproperties_can_exist_by_itself_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_additionalproperties_can_exist_by_itself_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_additionalproperties_can_exist_by_itself_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_additionalproperties_can_exist_by_itself_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_additionalproperties_can_exist_by_itself_request_body/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_additionalproperties_can_exist_by_itself_request_body/post/__init__.py new file mode 100644 index 00000000000..060201d75d1 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_additionalproperties_can_exist_by_itself_request_body/post/__init__.py @@ -0,0 +1,291 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.additionalproperties_can_exist_by_itself import AdditionalpropertiesCanExistByItself + +from .. import path +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = AdditionalpropertiesCanExistByItself + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + +_status_code_to_response = { + '200': response_for_200.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _post_additionalproperties_can_exist_by_itself_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_additionalproperties_can_exist_by_itself_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_additionalproperties_can_exist_by_itself_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_additionalproperties_can_exist_by_itself_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_additionalproperties_can_exist_by_itself_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostAdditionalpropertiesCanExistByItselfRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_additionalproperties_can_exist_by_itself_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_additionalproperties_can_exist_by_itself_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_additionalproperties_can_exist_by_itself_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_additionalproperties_can_exist_by_itself_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_additionalproperties_can_exist_by_itself_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_additionalproperties_can_exist_by_itself_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_additionalproperties_can_exist_by_itself_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_additionalproperties_can_exist_by_itself_request_body/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_additionalproperties_can_exist_by_itself_request_body/post/__init__.pyi new file mode 100644 index 00000000000..6119340a9a2 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_additionalproperties_can_exist_by_itself_request_body/post/__init__.pyi @@ -0,0 +1,286 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.additionalproperties_can_exist_by_itself import AdditionalpropertiesCanExistByItself + +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = AdditionalpropertiesCanExistByItself + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_additionalproperties_can_exist_by_itself_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_additionalproperties_can_exist_by_itself_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_additionalproperties_can_exist_by_itself_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_additionalproperties_can_exist_by_itself_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_additionalproperties_can_exist_by_itself_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostAdditionalpropertiesCanExistByItselfRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_additionalproperties_can_exist_by_itself_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_additionalproperties_can_exist_by_itself_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_additionalproperties_can_exist_by_itself_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_additionalproperties_can_exist_by_itself_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_additionalproperties_can_exist_by_itself_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_additionalproperties_can_exist_by_itself_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_additionalproperties_can_exist_by_itself_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_additionalproperties_can_exist_by_itself_request_body/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_additionalproperties_can_exist_by_itself_request_body/post/response_for_200.py new file mode 100644 index 00000000000..ce057133be3 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_additionalproperties_can_exist_by_itself_request_body/post/response_for_200.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_additionalproperties_should_not_look_in_applicators_request_body/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_additionalproperties_should_not_look_in_applicators_request_body/post.py deleted file mode 100644 index 0e3ae3974b9..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_additionalproperties_should_not_look_in_applicators_request_body/post.py +++ /dev/null @@ -1,298 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.additionalproperties_should_not_look_in_applicators import AdditionalpropertiesShouldNotLookInApplicators - -from . import path - -# body param -SchemaForRequestBodyApplicationJson = AdditionalpropertiesShouldNotLookInApplicators - - -request_body_additionalproperties_should_not_look_in_applicators = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) -_status_code_to_response = { - '200': _response_for_200, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _post_additionalproperties_should_not_look_in_applicators_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_additionalproperties_should_not_look_in_applicators_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_additionalproperties_should_not_look_in_applicators_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_additionalproperties_should_not_look_in_applicators_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_additionalproperties_should_not_look_in_applicators_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_additionalproperties_should_not_look_in_applicators.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostAdditionalpropertiesShouldNotLookInApplicatorsRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_additionalproperties_should_not_look_in_applicators_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_additionalproperties_should_not_look_in_applicators_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_additionalproperties_should_not_look_in_applicators_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_additionalproperties_should_not_look_in_applicators_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_additionalproperties_should_not_look_in_applicators_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_additionalproperties_should_not_look_in_applicators_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_additionalproperties_should_not_look_in_applicators_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_additionalproperties_should_not_look_in_applicators_request_body/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_additionalproperties_should_not_look_in_applicators_request_body/post.pyi deleted file mode 100644 index fea43428f8b..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_additionalproperties_should_not_look_in_applicators_request_body/post.pyi +++ /dev/null @@ -1,293 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.additionalproperties_should_not_look_in_applicators import AdditionalpropertiesShouldNotLookInApplicators - -# body param -SchemaForRequestBodyApplicationJson = AdditionalpropertiesShouldNotLookInApplicators - - -request_body_additionalproperties_should_not_look_in_applicators = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_additionalproperties_should_not_look_in_applicators_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_additionalproperties_should_not_look_in_applicators_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_additionalproperties_should_not_look_in_applicators_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_additionalproperties_should_not_look_in_applicators_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_additionalproperties_should_not_look_in_applicators_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_additionalproperties_should_not_look_in_applicators.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostAdditionalpropertiesShouldNotLookInApplicatorsRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_additionalproperties_should_not_look_in_applicators_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_additionalproperties_should_not_look_in_applicators_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_additionalproperties_should_not_look_in_applicators_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_additionalproperties_should_not_look_in_applicators_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_additionalproperties_should_not_look_in_applicators_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_additionalproperties_should_not_look_in_applicators_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_additionalproperties_should_not_look_in_applicators_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_additionalproperties_should_not_look_in_applicators_request_body/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_additionalproperties_should_not_look_in_applicators_request_body/post/__init__.py new file mode 100644 index 00000000000..1efb6033a67 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_additionalproperties_should_not_look_in_applicators_request_body/post/__init__.py @@ -0,0 +1,291 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.additionalproperties_should_not_look_in_applicators import AdditionalpropertiesShouldNotLookInApplicators + +from .. import path +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = AdditionalpropertiesShouldNotLookInApplicators + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + +_status_code_to_response = { + '200': response_for_200.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _post_additionalproperties_should_not_look_in_applicators_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_additionalproperties_should_not_look_in_applicators_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_additionalproperties_should_not_look_in_applicators_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_additionalproperties_should_not_look_in_applicators_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_additionalproperties_should_not_look_in_applicators_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostAdditionalpropertiesShouldNotLookInApplicatorsRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_additionalproperties_should_not_look_in_applicators_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_additionalproperties_should_not_look_in_applicators_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_additionalproperties_should_not_look_in_applicators_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_additionalproperties_should_not_look_in_applicators_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_additionalproperties_should_not_look_in_applicators_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_additionalproperties_should_not_look_in_applicators_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_additionalproperties_should_not_look_in_applicators_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_additionalproperties_should_not_look_in_applicators_request_body/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_additionalproperties_should_not_look_in_applicators_request_body/post/__init__.pyi new file mode 100644 index 00000000000..a00d91a8d91 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_additionalproperties_should_not_look_in_applicators_request_body/post/__init__.pyi @@ -0,0 +1,286 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.additionalproperties_should_not_look_in_applicators import AdditionalpropertiesShouldNotLookInApplicators + +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = AdditionalpropertiesShouldNotLookInApplicators + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_additionalproperties_should_not_look_in_applicators_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_additionalproperties_should_not_look_in_applicators_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_additionalproperties_should_not_look_in_applicators_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_additionalproperties_should_not_look_in_applicators_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_additionalproperties_should_not_look_in_applicators_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostAdditionalpropertiesShouldNotLookInApplicatorsRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_additionalproperties_should_not_look_in_applicators_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_additionalproperties_should_not_look_in_applicators_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_additionalproperties_should_not_look_in_applicators_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_additionalproperties_should_not_look_in_applicators_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_additionalproperties_should_not_look_in_applicators_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_additionalproperties_should_not_look_in_applicators_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_additionalproperties_should_not_look_in_applicators_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_additionalproperties_should_not_look_in_applicators_request_body/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_additionalproperties_should_not_look_in_applicators_request_body/post/response_for_200.py new file mode 100644 index 00000000000..ce057133be3 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_additionalproperties_should_not_look_in_applicators_request_body/post/response_for_200.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_combined_with_anyof_oneof_request_body/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_combined_with_anyof_oneof_request_body/post.py deleted file mode 100644 index 053e2d964a8..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_combined_with_anyof_oneof_request_body/post.py +++ /dev/null @@ -1,298 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.allof_combined_with_anyof_oneof import AllofCombinedWithAnyofOneof - -from . import path - -# body param -SchemaForRequestBodyApplicationJson = AllofCombinedWithAnyofOneof - - -request_body_allof_combined_with_anyof_oneof = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) -_status_code_to_response = { - '200': _response_for_200, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _post_allof_combined_with_anyof_oneof_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_allof_combined_with_anyof_oneof_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_allof_combined_with_anyof_oneof_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_allof_combined_with_anyof_oneof_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_allof_combined_with_anyof_oneof_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_allof_combined_with_anyof_oneof.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostAllofCombinedWithAnyofOneofRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_allof_combined_with_anyof_oneof_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_allof_combined_with_anyof_oneof_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_allof_combined_with_anyof_oneof_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_allof_combined_with_anyof_oneof_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_allof_combined_with_anyof_oneof_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_allof_combined_with_anyof_oneof_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_allof_combined_with_anyof_oneof_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_combined_with_anyof_oneof_request_body/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_combined_with_anyof_oneof_request_body/post.pyi deleted file mode 100644 index e62508b3e27..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_combined_with_anyof_oneof_request_body/post.pyi +++ /dev/null @@ -1,293 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.allof_combined_with_anyof_oneof import AllofCombinedWithAnyofOneof - -# body param -SchemaForRequestBodyApplicationJson = AllofCombinedWithAnyofOneof - - -request_body_allof_combined_with_anyof_oneof = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_allof_combined_with_anyof_oneof_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_allof_combined_with_anyof_oneof_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_allof_combined_with_anyof_oneof_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_allof_combined_with_anyof_oneof_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_allof_combined_with_anyof_oneof_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_allof_combined_with_anyof_oneof.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostAllofCombinedWithAnyofOneofRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_allof_combined_with_anyof_oneof_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_allof_combined_with_anyof_oneof_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_allof_combined_with_anyof_oneof_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_allof_combined_with_anyof_oneof_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_allof_combined_with_anyof_oneof_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_allof_combined_with_anyof_oneof_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_allof_combined_with_anyof_oneof_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_combined_with_anyof_oneof_request_body/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_combined_with_anyof_oneof_request_body/post/__init__.py new file mode 100644 index 00000000000..2bd936a13d7 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_combined_with_anyof_oneof_request_body/post/__init__.py @@ -0,0 +1,291 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.allof_combined_with_anyof_oneof import AllofCombinedWithAnyofOneof + +from .. import path +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = AllofCombinedWithAnyofOneof + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + +_status_code_to_response = { + '200': response_for_200.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _post_allof_combined_with_anyof_oneof_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_allof_combined_with_anyof_oneof_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_allof_combined_with_anyof_oneof_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_allof_combined_with_anyof_oneof_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_allof_combined_with_anyof_oneof_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostAllofCombinedWithAnyofOneofRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_allof_combined_with_anyof_oneof_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_allof_combined_with_anyof_oneof_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_allof_combined_with_anyof_oneof_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_allof_combined_with_anyof_oneof_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_allof_combined_with_anyof_oneof_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_allof_combined_with_anyof_oneof_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_allof_combined_with_anyof_oneof_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_combined_with_anyof_oneof_request_body/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_combined_with_anyof_oneof_request_body/post/__init__.pyi new file mode 100644 index 00000000000..f36e2d42a56 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_combined_with_anyof_oneof_request_body/post/__init__.pyi @@ -0,0 +1,286 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.allof_combined_with_anyof_oneof import AllofCombinedWithAnyofOneof + +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = AllofCombinedWithAnyofOneof + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_allof_combined_with_anyof_oneof_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_allof_combined_with_anyof_oneof_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_allof_combined_with_anyof_oneof_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_allof_combined_with_anyof_oneof_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_allof_combined_with_anyof_oneof_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostAllofCombinedWithAnyofOneofRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_allof_combined_with_anyof_oneof_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_allof_combined_with_anyof_oneof_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_allof_combined_with_anyof_oneof_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_allof_combined_with_anyof_oneof_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_allof_combined_with_anyof_oneof_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_allof_combined_with_anyof_oneof_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_allof_combined_with_anyof_oneof_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_combined_with_anyof_oneof_request_body/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_combined_with_anyof_oneof_request_body/post/response_for_200.py new file mode 100644 index 00000000000..ce057133be3 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_combined_with_anyof_oneof_request_body/post/response_for_200.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_request_body/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_request_body/post.py deleted file mode 100644 index 89a3a940196..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_request_body/post.py +++ /dev/null @@ -1,298 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.allof import Allof - -from . import path - -# body param -SchemaForRequestBodyApplicationJson = Allof - - -request_body_allof = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) -_status_code_to_response = { - '200': _response_for_200, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _post_allof_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_allof_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_allof_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_allof_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_allof_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_allof.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostAllofRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_allof_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_allof_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_allof_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_allof_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_allof_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_allof_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_allof_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_request_body/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_request_body/post.pyi deleted file mode 100644 index 4deddd781e7..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_request_body/post.pyi +++ /dev/null @@ -1,293 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.allof import Allof - -# body param -SchemaForRequestBodyApplicationJson = Allof - - -request_body_allof = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_allof_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_allof_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_allof_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_allof_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_allof_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_allof.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostAllofRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_allof_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_allof_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_allof_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_allof_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_allof_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_allof_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_allof_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_request_body/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_request_body/post/__init__.py new file mode 100644 index 00000000000..f763ebc371c --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_request_body/post/__init__.py @@ -0,0 +1,291 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.allof import Allof + +from .. import path +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = Allof + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + +_status_code_to_response = { + '200': response_for_200.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _post_allof_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_allof_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_allof_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_allof_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_allof_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostAllofRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_allof_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_allof_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_allof_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_allof_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_allof_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_allof_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_allof_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_request_body/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_request_body/post/__init__.pyi new file mode 100644 index 00000000000..3e324741beb --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_request_body/post/__init__.pyi @@ -0,0 +1,286 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.allof import Allof + +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = Allof + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_allof_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_allof_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_allof_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_allof_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_allof_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostAllofRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_allof_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_allof_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_allof_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_allof_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_allof_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_allof_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_allof_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_request_body/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_request_body/post/response_for_200.py new file mode 100644 index 00000000000..ce057133be3 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_request_body/post/response_for_200.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_simple_types_request_body/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_simple_types_request_body/post.py deleted file mode 100644 index 5bc90d06c4c..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_simple_types_request_body/post.py +++ /dev/null @@ -1,298 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.allof_simple_types import AllofSimpleTypes - -from . import path - -# body param -SchemaForRequestBodyApplicationJson = AllofSimpleTypes - - -request_body_allof_simple_types = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) -_status_code_to_response = { - '200': _response_for_200, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _post_allof_simple_types_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_allof_simple_types_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_allof_simple_types_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_allof_simple_types_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_allof_simple_types_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_allof_simple_types.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostAllofSimpleTypesRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_allof_simple_types_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_allof_simple_types_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_allof_simple_types_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_allof_simple_types_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_allof_simple_types_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_allof_simple_types_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_allof_simple_types_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_simple_types_request_body/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_simple_types_request_body/post.pyi deleted file mode 100644 index f334d8eeb46..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_simple_types_request_body/post.pyi +++ /dev/null @@ -1,293 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.allof_simple_types import AllofSimpleTypes - -# body param -SchemaForRequestBodyApplicationJson = AllofSimpleTypes - - -request_body_allof_simple_types = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_allof_simple_types_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_allof_simple_types_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_allof_simple_types_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_allof_simple_types_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_allof_simple_types_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_allof_simple_types.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostAllofSimpleTypesRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_allof_simple_types_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_allof_simple_types_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_allof_simple_types_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_allof_simple_types_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_allof_simple_types_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_allof_simple_types_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_allof_simple_types_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_simple_types_request_body/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_simple_types_request_body/post/__init__.py new file mode 100644 index 00000000000..d5da30df661 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_simple_types_request_body/post/__init__.py @@ -0,0 +1,291 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.allof_simple_types import AllofSimpleTypes + +from .. import path +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = AllofSimpleTypes + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + +_status_code_to_response = { + '200': response_for_200.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _post_allof_simple_types_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_allof_simple_types_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_allof_simple_types_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_allof_simple_types_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_allof_simple_types_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostAllofSimpleTypesRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_allof_simple_types_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_allof_simple_types_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_allof_simple_types_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_allof_simple_types_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_allof_simple_types_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_allof_simple_types_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_allof_simple_types_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_simple_types_request_body/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_simple_types_request_body/post/__init__.pyi new file mode 100644 index 00000000000..109651dd09b --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_simple_types_request_body/post/__init__.pyi @@ -0,0 +1,286 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.allof_simple_types import AllofSimpleTypes + +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = AllofSimpleTypes + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_allof_simple_types_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_allof_simple_types_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_allof_simple_types_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_allof_simple_types_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_allof_simple_types_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostAllofSimpleTypesRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_allof_simple_types_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_allof_simple_types_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_allof_simple_types_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_allof_simple_types_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_allof_simple_types_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_allof_simple_types_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_allof_simple_types_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_simple_types_request_body/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_simple_types_request_body/post/response_for_200.py new file mode 100644 index 00000000000..ce057133be3 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_simple_types_request_body/post/response_for_200.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_with_base_schema_request_body/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_with_base_schema_request_body/post.py deleted file mode 100644 index 0af6bbed3ee..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_with_base_schema_request_body/post.py +++ /dev/null @@ -1,298 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.allof_with_base_schema import AllofWithBaseSchema - -from . import path - -# body param -SchemaForRequestBodyApplicationJson = AllofWithBaseSchema - - -request_body_allof_with_base_schema = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) -_status_code_to_response = { - '200': _response_for_200, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _post_allof_with_base_schema_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_allof_with_base_schema_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_allof_with_base_schema_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_allof_with_base_schema_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_allof_with_base_schema_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_allof_with_base_schema.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostAllofWithBaseSchemaRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_allof_with_base_schema_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_allof_with_base_schema_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_allof_with_base_schema_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_allof_with_base_schema_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_allof_with_base_schema_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_allof_with_base_schema_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_allof_with_base_schema_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_with_base_schema_request_body/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_with_base_schema_request_body/post.pyi deleted file mode 100644 index b973fab5af3..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_with_base_schema_request_body/post.pyi +++ /dev/null @@ -1,293 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.allof_with_base_schema import AllofWithBaseSchema - -# body param -SchemaForRequestBodyApplicationJson = AllofWithBaseSchema - - -request_body_allof_with_base_schema = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_allof_with_base_schema_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_allof_with_base_schema_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_allof_with_base_schema_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_allof_with_base_schema_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_allof_with_base_schema_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_allof_with_base_schema.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostAllofWithBaseSchemaRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_allof_with_base_schema_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_allof_with_base_schema_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_allof_with_base_schema_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_allof_with_base_schema_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_allof_with_base_schema_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_allof_with_base_schema_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_allof_with_base_schema_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_with_base_schema_request_body/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_with_base_schema_request_body/post/__init__.py new file mode 100644 index 00000000000..229276a93e0 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_with_base_schema_request_body/post/__init__.py @@ -0,0 +1,291 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.allof_with_base_schema import AllofWithBaseSchema + +from .. import path +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = AllofWithBaseSchema + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + +_status_code_to_response = { + '200': response_for_200.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _post_allof_with_base_schema_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_allof_with_base_schema_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_allof_with_base_schema_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_allof_with_base_schema_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_allof_with_base_schema_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostAllofWithBaseSchemaRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_allof_with_base_schema_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_allof_with_base_schema_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_allof_with_base_schema_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_allof_with_base_schema_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_allof_with_base_schema_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_allof_with_base_schema_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_allof_with_base_schema_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_with_base_schema_request_body/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_with_base_schema_request_body/post/__init__.pyi new file mode 100644 index 00000000000..5966d14e457 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_with_base_schema_request_body/post/__init__.pyi @@ -0,0 +1,286 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.allof_with_base_schema import AllofWithBaseSchema + +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = AllofWithBaseSchema + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_allof_with_base_schema_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_allof_with_base_schema_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_allof_with_base_schema_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_allof_with_base_schema_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_allof_with_base_schema_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostAllofWithBaseSchemaRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_allof_with_base_schema_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_allof_with_base_schema_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_allof_with_base_schema_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_allof_with_base_schema_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_allof_with_base_schema_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_allof_with_base_schema_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_allof_with_base_schema_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_with_base_schema_request_body/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_with_base_schema_request_body/post/response_for_200.py new file mode 100644 index 00000000000..ce057133be3 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_with_base_schema_request_body/post/response_for_200.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_with_one_empty_schema_request_body/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_with_one_empty_schema_request_body/post.py deleted file mode 100644 index 05980415518..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_with_one_empty_schema_request_body/post.py +++ /dev/null @@ -1,298 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.allof_with_one_empty_schema import AllofWithOneEmptySchema - -from . import path - -# body param -SchemaForRequestBodyApplicationJson = AllofWithOneEmptySchema - - -request_body_allof_with_one_empty_schema = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) -_status_code_to_response = { - '200': _response_for_200, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _post_allof_with_one_empty_schema_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_allof_with_one_empty_schema_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_allof_with_one_empty_schema_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_allof_with_one_empty_schema_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_allof_with_one_empty_schema_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_allof_with_one_empty_schema.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostAllofWithOneEmptySchemaRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_allof_with_one_empty_schema_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_allof_with_one_empty_schema_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_allof_with_one_empty_schema_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_allof_with_one_empty_schema_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_allof_with_one_empty_schema_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_allof_with_one_empty_schema_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_allof_with_one_empty_schema_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_with_one_empty_schema_request_body/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_with_one_empty_schema_request_body/post.pyi deleted file mode 100644 index 19358a62aea..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_with_one_empty_schema_request_body/post.pyi +++ /dev/null @@ -1,293 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.allof_with_one_empty_schema import AllofWithOneEmptySchema - -# body param -SchemaForRequestBodyApplicationJson = AllofWithOneEmptySchema - - -request_body_allof_with_one_empty_schema = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_allof_with_one_empty_schema_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_allof_with_one_empty_schema_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_allof_with_one_empty_schema_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_allof_with_one_empty_schema_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_allof_with_one_empty_schema_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_allof_with_one_empty_schema.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostAllofWithOneEmptySchemaRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_allof_with_one_empty_schema_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_allof_with_one_empty_schema_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_allof_with_one_empty_schema_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_allof_with_one_empty_schema_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_allof_with_one_empty_schema_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_allof_with_one_empty_schema_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_allof_with_one_empty_schema_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_with_one_empty_schema_request_body/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_with_one_empty_schema_request_body/post/__init__.py new file mode 100644 index 00000000000..c88c42fb66e --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_with_one_empty_schema_request_body/post/__init__.py @@ -0,0 +1,291 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.allof_with_one_empty_schema import AllofWithOneEmptySchema + +from .. import path +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = AllofWithOneEmptySchema + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + +_status_code_to_response = { + '200': response_for_200.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _post_allof_with_one_empty_schema_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_allof_with_one_empty_schema_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_allof_with_one_empty_schema_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_allof_with_one_empty_schema_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_allof_with_one_empty_schema_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostAllofWithOneEmptySchemaRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_allof_with_one_empty_schema_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_allof_with_one_empty_schema_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_allof_with_one_empty_schema_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_allof_with_one_empty_schema_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_allof_with_one_empty_schema_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_allof_with_one_empty_schema_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_allof_with_one_empty_schema_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_with_one_empty_schema_request_body/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_with_one_empty_schema_request_body/post/__init__.pyi new file mode 100644 index 00000000000..e34082ec2e9 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_with_one_empty_schema_request_body/post/__init__.pyi @@ -0,0 +1,286 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.allof_with_one_empty_schema import AllofWithOneEmptySchema + +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = AllofWithOneEmptySchema + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_allof_with_one_empty_schema_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_allof_with_one_empty_schema_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_allof_with_one_empty_schema_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_allof_with_one_empty_schema_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_allof_with_one_empty_schema_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostAllofWithOneEmptySchemaRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_allof_with_one_empty_schema_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_allof_with_one_empty_schema_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_allof_with_one_empty_schema_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_allof_with_one_empty_schema_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_allof_with_one_empty_schema_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_allof_with_one_empty_schema_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_allof_with_one_empty_schema_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_with_one_empty_schema_request_body/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_with_one_empty_schema_request_body/post/response_for_200.py new file mode 100644 index 00000000000..ce057133be3 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_with_one_empty_schema_request_body/post/response_for_200.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_with_the_first_empty_schema_request_body/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_with_the_first_empty_schema_request_body/post.py deleted file mode 100644 index 3d2e11c3469..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_with_the_first_empty_schema_request_body/post.py +++ /dev/null @@ -1,298 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.allof_with_the_first_empty_schema import AllofWithTheFirstEmptySchema - -from . import path - -# body param -SchemaForRequestBodyApplicationJson = AllofWithTheFirstEmptySchema - - -request_body_allof_with_the_first_empty_schema = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) -_status_code_to_response = { - '200': _response_for_200, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _post_allof_with_the_first_empty_schema_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_allof_with_the_first_empty_schema_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_allof_with_the_first_empty_schema_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_allof_with_the_first_empty_schema_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_allof_with_the_first_empty_schema_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_allof_with_the_first_empty_schema.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostAllofWithTheFirstEmptySchemaRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_allof_with_the_first_empty_schema_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_allof_with_the_first_empty_schema_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_allof_with_the_first_empty_schema_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_allof_with_the_first_empty_schema_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_allof_with_the_first_empty_schema_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_allof_with_the_first_empty_schema_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_allof_with_the_first_empty_schema_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_with_the_first_empty_schema_request_body/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_with_the_first_empty_schema_request_body/post.pyi deleted file mode 100644 index 9094994b1f1..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_with_the_first_empty_schema_request_body/post.pyi +++ /dev/null @@ -1,293 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.allof_with_the_first_empty_schema import AllofWithTheFirstEmptySchema - -# body param -SchemaForRequestBodyApplicationJson = AllofWithTheFirstEmptySchema - - -request_body_allof_with_the_first_empty_schema = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_allof_with_the_first_empty_schema_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_allof_with_the_first_empty_schema_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_allof_with_the_first_empty_schema_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_allof_with_the_first_empty_schema_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_allof_with_the_first_empty_schema_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_allof_with_the_first_empty_schema.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostAllofWithTheFirstEmptySchemaRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_allof_with_the_first_empty_schema_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_allof_with_the_first_empty_schema_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_allof_with_the_first_empty_schema_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_allof_with_the_first_empty_schema_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_allof_with_the_first_empty_schema_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_allof_with_the_first_empty_schema_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_allof_with_the_first_empty_schema_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_with_the_first_empty_schema_request_body/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_with_the_first_empty_schema_request_body/post/__init__.py new file mode 100644 index 00000000000..6efe4cb7318 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_with_the_first_empty_schema_request_body/post/__init__.py @@ -0,0 +1,291 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.allof_with_the_first_empty_schema import AllofWithTheFirstEmptySchema + +from .. import path +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = AllofWithTheFirstEmptySchema + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + +_status_code_to_response = { + '200': response_for_200.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _post_allof_with_the_first_empty_schema_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_allof_with_the_first_empty_schema_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_allof_with_the_first_empty_schema_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_allof_with_the_first_empty_schema_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_allof_with_the_first_empty_schema_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostAllofWithTheFirstEmptySchemaRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_allof_with_the_first_empty_schema_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_allof_with_the_first_empty_schema_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_allof_with_the_first_empty_schema_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_allof_with_the_first_empty_schema_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_allof_with_the_first_empty_schema_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_allof_with_the_first_empty_schema_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_allof_with_the_first_empty_schema_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_with_the_first_empty_schema_request_body/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_with_the_first_empty_schema_request_body/post/__init__.pyi new file mode 100644 index 00000000000..b21544a67ae --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_with_the_first_empty_schema_request_body/post/__init__.pyi @@ -0,0 +1,286 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.allof_with_the_first_empty_schema import AllofWithTheFirstEmptySchema + +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = AllofWithTheFirstEmptySchema + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_allof_with_the_first_empty_schema_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_allof_with_the_first_empty_schema_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_allof_with_the_first_empty_schema_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_allof_with_the_first_empty_schema_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_allof_with_the_first_empty_schema_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostAllofWithTheFirstEmptySchemaRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_allof_with_the_first_empty_schema_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_allof_with_the_first_empty_schema_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_allof_with_the_first_empty_schema_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_allof_with_the_first_empty_schema_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_allof_with_the_first_empty_schema_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_allof_with_the_first_empty_schema_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_allof_with_the_first_empty_schema_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_with_the_first_empty_schema_request_body/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_with_the_first_empty_schema_request_body/post/response_for_200.py new file mode 100644 index 00000000000..ce057133be3 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_with_the_first_empty_schema_request_body/post/response_for_200.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_with_the_last_empty_schema_request_body/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_with_the_last_empty_schema_request_body/post.py deleted file mode 100644 index 427873e4714..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_with_the_last_empty_schema_request_body/post.py +++ /dev/null @@ -1,298 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.allof_with_the_last_empty_schema import AllofWithTheLastEmptySchema - -from . import path - -# body param -SchemaForRequestBodyApplicationJson = AllofWithTheLastEmptySchema - - -request_body_allof_with_the_last_empty_schema = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) -_status_code_to_response = { - '200': _response_for_200, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _post_allof_with_the_last_empty_schema_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_allof_with_the_last_empty_schema_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_allof_with_the_last_empty_schema_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_allof_with_the_last_empty_schema_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_allof_with_the_last_empty_schema_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_allof_with_the_last_empty_schema.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostAllofWithTheLastEmptySchemaRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_allof_with_the_last_empty_schema_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_allof_with_the_last_empty_schema_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_allof_with_the_last_empty_schema_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_allof_with_the_last_empty_schema_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_allof_with_the_last_empty_schema_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_allof_with_the_last_empty_schema_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_allof_with_the_last_empty_schema_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_with_the_last_empty_schema_request_body/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_with_the_last_empty_schema_request_body/post.pyi deleted file mode 100644 index fa64bb7f00e..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_with_the_last_empty_schema_request_body/post.pyi +++ /dev/null @@ -1,293 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.allof_with_the_last_empty_schema import AllofWithTheLastEmptySchema - -# body param -SchemaForRequestBodyApplicationJson = AllofWithTheLastEmptySchema - - -request_body_allof_with_the_last_empty_schema = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_allof_with_the_last_empty_schema_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_allof_with_the_last_empty_schema_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_allof_with_the_last_empty_schema_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_allof_with_the_last_empty_schema_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_allof_with_the_last_empty_schema_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_allof_with_the_last_empty_schema.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostAllofWithTheLastEmptySchemaRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_allof_with_the_last_empty_schema_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_allof_with_the_last_empty_schema_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_allof_with_the_last_empty_schema_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_allof_with_the_last_empty_schema_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_allof_with_the_last_empty_schema_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_allof_with_the_last_empty_schema_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_allof_with_the_last_empty_schema_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_with_the_last_empty_schema_request_body/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_with_the_last_empty_schema_request_body/post/__init__.py new file mode 100644 index 00000000000..cef8ff6fbb4 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_with_the_last_empty_schema_request_body/post/__init__.py @@ -0,0 +1,291 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.allof_with_the_last_empty_schema import AllofWithTheLastEmptySchema + +from .. import path +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = AllofWithTheLastEmptySchema + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + +_status_code_to_response = { + '200': response_for_200.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _post_allof_with_the_last_empty_schema_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_allof_with_the_last_empty_schema_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_allof_with_the_last_empty_schema_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_allof_with_the_last_empty_schema_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_allof_with_the_last_empty_schema_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostAllofWithTheLastEmptySchemaRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_allof_with_the_last_empty_schema_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_allof_with_the_last_empty_schema_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_allof_with_the_last_empty_schema_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_allof_with_the_last_empty_schema_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_allof_with_the_last_empty_schema_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_allof_with_the_last_empty_schema_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_allof_with_the_last_empty_schema_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_with_the_last_empty_schema_request_body/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_with_the_last_empty_schema_request_body/post/__init__.pyi new file mode 100644 index 00000000000..98a2a02a1ce --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_with_the_last_empty_schema_request_body/post/__init__.pyi @@ -0,0 +1,286 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.allof_with_the_last_empty_schema import AllofWithTheLastEmptySchema + +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = AllofWithTheLastEmptySchema + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_allof_with_the_last_empty_schema_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_allof_with_the_last_empty_schema_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_allof_with_the_last_empty_schema_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_allof_with_the_last_empty_schema_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_allof_with_the_last_empty_schema_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostAllofWithTheLastEmptySchemaRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_allof_with_the_last_empty_schema_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_allof_with_the_last_empty_schema_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_allof_with_the_last_empty_schema_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_allof_with_the_last_empty_schema_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_allof_with_the_last_empty_schema_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_allof_with_the_last_empty_schema_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_allof_with_the_last_empty_schema_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_with_the_last_empty_schema_request_body/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_with_the_last_empty_schema_request_body/post/response_for_200.py new file mode 100644 index 00000000000..ce057133be3 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_with_the_last_empty_schema_request_body/post/response_for_200.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_with_two_empty_schemas_request_body/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_with_two_empty_schemas_request_body/post.py deleted file mode 100644 index c47e5a94113..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_with_two_empty_schemas_request_body/post.py +++ /dev/null @@ -1,298 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.allof_with_two_empty_schemas import AllofWithTwoEmptySchemas - -from . import path - -# body param -SchemaForRequestBodyApplicationJson = AllofWithTwoEmptySchemas - - -request_body_allof_with_two_empty_schemas = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) -_status_code_to_response = { - '200': _response_for_200, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _post_allof_with_two_empty_schemas_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_allof_with_two_empty_schemas_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_allof_with_two_empty_schemas_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_allof_with_two_empty_schemas_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_allof_with_two_empty_schemas_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_allof_with_two_empty_schemas.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostAllofWithTwoEmptySchemasRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_allof_with_two_empty_schemas_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_allof_with_two_empty_schemas_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_allof_with_two_empty_schemas_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_allof_with_two_empty_schemas_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_allof_with_two_empty_schemas_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_allof_with_two_empty_schemas_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_allof_with_two_empty_schemas_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_with_two_empty_schemas_request_body/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_with_two_empty_schemas_request_body/post.pyi deleted file mode 100644 index 3f4116de0f3..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_with_two_empty_schemas_request_body/post.pyi +++ /dev/null @@ -1,293 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.allof_with_two_empty_schemas import AllofWithTwoEmptySchemas - -# body param -SchemaForRequestBodyApplicationJson = AllofWithTwoEmptySchemas - - -request_body_allof_with_two_empty_schemas = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_allof_with_two_empty_schemas_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_allof_with_two_empty_schemas_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_allof_with_two_empty_schemas_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_allof_with_two_empty_schemas_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_allof_with_two_empty_schemas_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_allof_with_two_empty_schemas.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostAllofWithTwoEmptySchemasRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_allof_with_two_empty_schemas_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_allof_with_two_empty_schemas_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_allof_with_two_empty_schemas_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_allof_with_two_empty_schemas_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_allof_with_two_empty_schemas_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_allof_with_two_empty_schemas_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_allof_with_two_empty_schemas_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_with_two_empty_schemas_request_body/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_with_two_empty_schemas_request_body/post/__init__.py new file mode 100644 index 00000000000..36cb313d7fc --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_with_two_empty_schemas_request_body/post/__init__.py @@ -0,0 +1,291 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.allof_with_two_empty_schemas import AllofWithTwoEmptySchemas + +from .. import path +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = AllofWithTwoEmptySchemas + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + +_status_code_to_response = { + '200': response_for_200.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _post_allof_with_two_empty_schemas_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_allof_with_two_empty_schemas_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_allof_with_two_empty_schemas_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_allof_with_two_empty_schemas_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_allof_with_two_empty_schemas_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostAllofWithTwoEmptySchemasRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_allof_with_two_empty_schemas_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_allof_with_two_empty_schemas_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_allof_with_two_empty_schemas_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_allof_with_two_empty_schemas_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_allof_with_two_empty_schemas_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_allof_with_two_empty_schemas_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_allof_with_two_empty_schemas_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_with_two_empty_schemas_request_body/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_with_two_empty_schemas_request_body/post/__init__.pyi new file mode 100644 index 00000000000..baf17e20546 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_with_two_empty_schemas_request_body/post/__init__.pyi @@ -0,0 +1,286 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.allof_with_two_empty_schemas import AllofWithTwoEmptySchemas + +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = AllofWithTwoEmptySchemas + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_allof_with_two_empty_schemas_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_allof_with_two_empty_schemas_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_allof_with_two_empty_schemas_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_allof_with_two_empty_schemas_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_allof_with_two_empty_schemas_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostAllofWithTwoEmptySchemasRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_allof_with_two_empty_schemas_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_allof_with_two_empty_schemas_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_allof_with_two_empty_schemas_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_allof_with_two_empty_schemas_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_allof_with_two_empty_schemas_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_allof_with_two_empty_schemas_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_allof_with_two_empty_schemas_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_with_two_empty_schemas_request_body/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_with_two_empty_schemas_request_body/post/response_for_200.py new file mode 100644 index 00000000000..ce057133be3 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_allof_with_two_empty_schemas_request_body/post/response_for_200.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_anyof_complex_types_request_body/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_anyof_complex_types_request_body/post.py deleted file mode 100644 index bc529f7e117..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_anyof_complex_types_request_body/post.py +++ /dev/null @@ -1,298 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.anyof_complex_types import AnyofComplexTypes - -from . import path - -# body param -SchemaForRequestBodyApplicationJson = AnyofComplexTypes - - -request_body_anyof_complex_types = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) -_status_code_to_response = { - '200': _response_for_200, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _post_anyof_complex_types_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_anyof_complex_types_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_anyof_complex_types_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_anyof_complex_types_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_anyof_complex_types_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_anyof_complex_types.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostAnyofComplexTypesRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_anyof_complex_types_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_anyof_complex_types_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_anyof_complex_types_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_anyof_complex_types_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_anyof_complex_types_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_anyof_complex_types_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_anyof_complex_types_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_anyof_complex_types_request_body/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_anyof_complex_types_request_body/post.pyi deleted file mode 100644 index 8b1ea8f8ca4..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_anyof_complex_types_request_body/post.pyi +++ /dev/null @@ -1,293 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.anyof_complex_types import AnyofComplexTypes - -# body param -SchemaForRequestBodyApplicationJson = AnyofComplexTypes - - -request_body_anyof_complex_types = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_anyof_complex_types_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_anyof_complex_types_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_anyof_complex_types_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_anyof_complex_types_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_anyof_complex_types_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_anyof_complex_types.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostAnyofComplexTypesRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_anyof_complex_types_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_anyof_complex_types_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_anyof_complex_types_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_anyof_complex_types_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_anyof_complex_types_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_anyof_complex_types_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_anyof_complex_types_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_anyof_complex_types_request_body/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_anyof_complex_types_request_body/post/__init__.py new file mode 100644 index 00000000000..aabb1d22935 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_anyof_complex_types_request_body/post/__init__.py @@ -0,0 +1,291 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.anyof_complex_types import AnyofComplexTypes + +from .. import path +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = AnyofComplexTypes + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + +_status_code_to_response = { + '200': response_for_200.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _post_anyof_complex_types_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_anyof_complex_types_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_anyof_complex_types_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_anyof_complex_types_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_anyof_complex_types_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostAnyofComplexTypesRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_anyof_complex_types_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_anyof_complex_types_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_anyof_complex_types_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_anyof_complex_types_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_anyof_complex_types_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_anyof_complex_types_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_anyof_complex_types_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_anyof_complex_types_request_body/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_anyof_complex_types_request_body/post/__init__.pyi new file mode 100644 index 00000000000..106e8af5f48 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_anyof_complex_types_request_body/post/__init__.pyi @@ -0,0 +1,286 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.anyof_complex_types import AnyofComplexTypes + +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = AnyofComplexTypes + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_anyof_complex_types_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_anyof_complex_types_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_anyof_complex_types_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_anyof_complex_types_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_anyof_complex_types_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostAnyofComplexTypesRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_anyof_complex_types_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_anyof_complex_types_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_anyof_complex_types_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_anyof_complex_types_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_anyof_complex_types_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_anyof_complex_types_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_anyof_complex_types_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_anyof_complex_types_request_body/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_anyof_complex_types_request_body/post/response_for_200.py new file mode 100644 index 00000000000..ce057133be3 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_anyof_complex_types_request_body/post/response_for_200.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_anyof_request_body/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_anyof_request_body/post.py deleted file mode 100644 index 8e99ee7a3c2..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_anyof_request_body/post.py +++ /dev/null @@ -1,298 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.anyof import Anyof - -from . import path - -# body param -SchemaForRequestBodyApplicationJson = Anyof - - -request_body_anyof = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) -_status_code_to_response = { - '200': _response_for_200, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _post_anyof_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_anyof_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_anyof_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_anyof_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_anyof_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_anyof.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostAnyofRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_anyof_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_anyof_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_anyof_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_anyof_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_anyof_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_anyof_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_anyof_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_anyof_request_body/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_anyof_request_body/post.pyi deleted file mode 100644 index 69a0a26d932..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_anyof_request_body/post.pyi +++ /dev/null @@ -1,293 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.anyof import Anyof - -# body param -SchemaForRequestBodyApplicationJson = Anyof - - -request_body_anyof = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_anyof_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_anyof_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_anyof_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_anyof_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_anyof_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_anyof.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostAnyofRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_anyof_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_anyof_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_anyof_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_anyof_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_anyof_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_anyof_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_anyof_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_anyof_request_body/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_anyof_request_body/post/__init__.py new file mode 100644 index 00000000000..dab283e8b17 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_anyof_request_body/post/__init__.py @@ -0,0 +1,291 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.anyof import Anyof + +from .. import path +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = Anyof + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + +_status_code_to_response = { + '200': response_for_200.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _post_anyof_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_anyof_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_anyof_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_anyof_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_anyof_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostAnyofRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_anyof_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_anyof_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_anyof_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_anyof_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_anyof_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_anyof_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_anyof_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_anyof_request_body/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_anyof_request_body/post/__init__.pyi new file mode 100644 index 00000000000..10b760da6e6 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_anyof_request_body/post/__init__.pyi @@ -0,0 +1,286 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.anyof import Anyof + +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = Anyof + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_anyof_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_anyof_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_anyof_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_anyof_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_anyof_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostAnyofRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_anyof_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_anyof_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_anyof_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_anyof_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_anyof_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_anyof_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_anyof_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_anyof_request_body/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_anyof_request_body/post/response_for_200.py new file mode 100644 index 00000000000..ce057133be3 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_anyof_request_body/post/response_for_200.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_anyof_with_base_schema_request_body/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_anyof_with_base_schema_request_body/post.py deleted file mode 100644 index 217369cd910..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_anyof_with_base_schema_request_body/post.py +++ /dev/null @@ -1,298 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.anyof_with_base_schema import AnyofWithBaseSchema - -from . import path - -# body param -SchemaForRequestBodyApplicationJson = AnyofWithBaseSchema - - -request_body_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) -_status_code_to_response = { - '200': _response_for_200, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _post_anyof_with_base_schema_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_anyof_with_base_schema_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_anyof_with_base_schema_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_anyof_with_base_schema_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_anyof_with_base_schema_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostAnyofWithBaseSchemaRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_anyof_with_base_schema_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_anyof_with_base_schema_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_anyof_with_base_schema_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_anyof_with_base_schema_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_anyof_with_base_schema_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_anyof_with_base_schema_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_anyof_with_base_schema_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_anyof_with_base_schema_request_body/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_anyof_with_base_schema_request_body/post.pyi deleted file mode 100644 index bc85fc6cd10..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_anyof_with_base_schema_request_body/post.pyi +++ /dev/null @@ -1,293 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.anyof_with_base_schema import AnyofWithBaseSchema - -# body param -SchemaForRequestBodyApplicationJson = AnyofWithBaseSchema - - -request_body_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_anyof_with_base_schema_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_anyof_with_base_schema_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_anyof_with_base_schema_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_anyof_with_base_schema_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_anyof_with_base_schema_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostAnyofWithBaseSchemaRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_anyof_with_base_schema_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_anyof_with_base_schema_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_anyof_with_base_schema_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_anyof_with_base_schema_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_anyof_with_base_schema_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_anyof_with_base_schema_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_anyof_with_base_schema_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_anyof_with_base_schema_request_body/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_anyof_with_base_schema_request_body/post/__init__.py new file mode 100644 index 00000000000..4d0ae8c2e0a --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_anyof_with_base_schema_request_body/post/__init__.py @@ -0,0 +1,291 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.anyof_with_base_schema import AnyofWithBaseSchema + +from .. import path +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = AnyofWithBaseSchema + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + +_status_code_to_response = { + '200': response_for_200.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _post_anyof_with_base_schema_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_anyof_with_base_schema_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_anyof_with_base_schema_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_anyof_with_base_schema_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_anyof_with_base_schema_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostAnyofWithBaseSchemaRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_anyof_with_base_schema_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_anyof_with_base_schema_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_anyof_with_base_schema_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_anyof_with_base_schema_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_anyof_with_base_schema_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_anyof_with_base_schema_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_anyof_with_base_schema_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_anyof_with_base_schema_request_body/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_anyof_with_base_schema_request_body/post/__init__.pyi new file mode 100644 index 00000000000..7e7cf205a91 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_anyof_with_base_schema_request_body/post/__init__.pyi @@ -0,0 +1,286 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.anyof_with_base_schema import AnyofWithBaseSchema + +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = AnyofWithBaseSchema + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_anyof_with_base_schema_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_anyof_with_base_schema_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_anyof_with_base_schema_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_anyof_with_base_schema_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_anyof_with_base_schema_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostAnyofWithBaseSchemaRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_anyof_with_base_schema_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_anyof_with_base_schema_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_anyof_with_base_schema_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_anyof_with_base_schema_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_anyof_with_base_schema_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_anyof_with_base_schema_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_anyof_with_base_schema_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_anyof_with_base_schema_request_body/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_anyof_with_base_schema_request_body/post/response_for_200.py new file mode 100644 index 00000000000..ce057133be3 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_anyof_with_base_schema_request_body/post/response_for_200.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_anyof_with_one_empty_schema_request_body/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_anyof_with_one_empty_schema_request_body/post.py deleted file mode 100644 index f08f875b413..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_anyof_with_one_empty_schema_request_body/post.py +++ /dev/null @@ -1,298 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.anyof_with_one_empty_schema import AnyofWithOneEmptySchema - -from . import path - -# body param -SchemaForRequestBodyApplicationJson = AnyofWithOneEmptySchema - - -request_body_anyof_with_one_empty_schema = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) -_status_code_to_response = { - '200': _response_for_200, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _post_anyof_with_one_empty_schema_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_anyof_with_one_empty_schema_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_anyof_with_one_empty_schema_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_anyof_with_one_empty_schema_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_anyof_with_one_empty_schema_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_anyof_with_one_empty_schema.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostAnyofWithOneEmptySchemaRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_anyof_with_one_empty_schema_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_anyof_with_one_empty_schema_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_anyof_with_one_empty_schema_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_anyof_with_one_empty_schema_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_anyof_with_one_empty_schema_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_anyof_with_one_empty_schema_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_anyof_with_one_empty_schema_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_anyof_with_one_empty_schema_request_body/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_anyof_with_one_empty_schema_request_body/post.pyi deleted file mode 100644 index fdd3f85a03f..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_anyof_with_one_empty_schema_request_body/post.pyi +++ /dev/null @@ -1,293 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.anyof_with_one_empty_schema import AnyofWithOneEmptySchema - -# body param -SchemaForRequestBodyApplicationJson = AnyofWithOneEmptySchema - - -request_body_anyof_with_one_empty_schema = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_anyof_with_one_empty_schema_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_anyof_with_one_empty_schema_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_anyof_with_one_empty_schema_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_anyof_with_one_empty_schema_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_anyof_with_one_empty_schema_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_anyof_with_one_empty_schema.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostAnyofWithOneEmptySchemaRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_anyof_with_one_empty_schema_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_anyof_with_one_empty_schema_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_anyof_with_one_empty_schema_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_anyof_with_one_empty_schema_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_anyof_with_one_empty_schema_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_anyof_with_one_empty_schema_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_anyof_with_one_empty_schema_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_anyof_with_one_empty_schema_request_body/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_anyof_with_one_empty_schema_request_body/post/__init__.py new file mode 100644 index 00000000000..caa890cfd76 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_anyof_with_one_empty_schema_request_body/post/__init__.py @@ -0,0 +1,291 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.anyof_with_one_empty_schema import AnyofWithOneEmptySchema + +from .. import path +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = AnyofWithOneEmptySchema + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + +_status_code_to_response = { + '200': response_for_200.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _post_anyof_with_one_empty_schema_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_anyof_with_one_empty_schema_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_anyof_with_one_empty_schema_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_anyof_with_one_empty_schema_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_anyof_with_one_empty_schema_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostAnyofWithOneEmptySchemaRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_anyof_with_one_empty_schema_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_anyof_with_one_empty_schema_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_anyof_with_one_empty_schema_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_anyof_with_one_empty_schema_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_anyof_with_one_empty_schema_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_anyof_with_one_empty_schema_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_anyof_with_one_empty_schema_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_anyof_with_one_empty_schema_request_body/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_anyof_with_one_empty_schema_request_body/post/__init__.pyi new file mode 100644 index 00000000000..06e9f0680b9 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_anyof_with_one_empty_schema_request_body/post/__init__.pyi @@ -0,0 +1,286 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.anyof_with_one_empty_schema import AnyofWithOneEmptySchema + +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = AnyofWithOneEmptySchema + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_anyof_with_one_empty_schema_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_anyof_with_one_empty_schema_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_anyof_with_one_empty_schema_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_anyof_with_one_empty_schema_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_anyof_with_one_empty_schema_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostAnyofWithOneEmptySchemaRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_anyof_with_one_empty_schema_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_anyof_with_one_empty_schema_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_anyof_with_one_empty_schema_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_anyof_with_one_empty_schema_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_anyof_with_one_empty_schema_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_anyof_with_one_empty_schema_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_anyof_with_one_empty_schema_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_anyof_with_one_empty_schema_request_body/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_anyof_with_one_empty_schema_request_body/post/response_for_200.py new file mode 100644 index 00000000000..ce057133be3 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_anyof_with_one_empty_schema_request_body/post/response_for_200.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_array_type_matches_arrays_request_body/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_array_type_matches_arrays_request_body/post.py deleted file mode 100644 index 7511003b1d1..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_array_type_matches_arrays_request_body/post.py +++ /dev/null @@ -1,298 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.array_type_matches_arrays import ArrayTypeMatchesArrays - -from . import path - -# body param -SchemaForRequestBodyApplicationJson = ArrayTypeMatchesArrays - - -request_body_array_type_matches_arrays = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) -_status_code_to_response = { - '200': _response_for_200, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _post_array_type_matches_arrays_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_array_type_matches_arrays_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_array_type_matches_arrays_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_array_type_matches_arrays_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_array_type_matches_arrays_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_array_type_matches_arrays.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostArrayTypeMatchesArraysRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_array_type_matches_arrays_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_array_type_matches_arrays_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_array_type_matches_arrays_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_array_type_matches_arrays_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_array_type_matches_arrays_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_array_type_matches_arrays_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_array_type_matches_arrays_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_array_type_matches_arrays_request_body/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_array_type_matches_arrays_request_body/post.pyi deleted file mode 100644 index 672a3a3a6a4..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_array_type_matches_arrays_request_body/post.pyi +++ /dev/null @@ -1,293 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.array_type_matches_arrays import ArrayTypeMatchesArrays - -# body param -SchemaForRequestBodyApplicationJson = ArrayTypeMatchesArrays - - -request_body_array_type_matches_arrays = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_array_type_matches_arrays_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_array_type_matches_arrays_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_array_type_matches_arrays_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_array_type_matches_arrays_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_array_type_matches_arrays_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_array_type_matches_arrays.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostArrayTypeMatchesArraysRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_array_type_matches_arrays_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_array_type_matches_arrays_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_array_type_matches_arrays_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_array_type_matches_arrays_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_array_type_matches_arrays_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_array_type_matches_arrays_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_array_type_matches_arrays_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_array_type_matches_arrays_request_body/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_array_type_matches_arrays_request_body/post/__init__.py new file mode 100644 index 00000000000..164a202b37d --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_array_type_matches_arrays_request_body/post/__init__.py @@ -0,0 +1,291 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.array_type_matches_arrays import ArrayTypeMatchesArrays + +from .. import path +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = ArrayTypeMatchesArrays + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + +_status_code_to_response = { + '200': response_for_200.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _post_array_type_matches_arrays_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_array_type_matches_arrays_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_array_type_matches_arrays_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_array_type_matches_arrays_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_array_type_matches_arrays_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostArrayTypeMatchesArraysRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_array_type_matches_arrays_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_array_type_matches_arrays_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_array_type_matches_arrays_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_array_type_matches_arrays_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_array_type_matches_arrays_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_array_type_matches_arrays_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_array_type_matches_arrays_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_array_type_matches_arrays_request_body/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_array_type_matches_arrays_request_body/post/__init__.pyi new file mode 100644 index 00000000000..c4bd526c1ed --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_array_type_matches_arrays_request_body/post/__init__.pyi @@ -0,0 +1,286 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.array_type_matches_arrays import ArrayTypeMatchesArrays + +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = ArrayTypeMatchesArrays + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_array_type_matches_arrays_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_array_type_matches_arrays_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_array_type_matches_arrays_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_array_type_matches_arrays_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_array_type_matches_arrays_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostArrayTypeMatchesArraysRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_array_type_matches_arrays_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_array_type_matches_arrays_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_array_type_matches_arrays_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_array_type_matches_arrays_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_array_type_matches_arrays_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_array_type_matches_arrays_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_array_type_matches_arrays_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_array_type_matches_arrays_request_body/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_array_type_matches_arrays_request_body/post/response_for_200.py new file mode 100644 index 00000000000..ce057133be3 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_array_type_matches_arrays_request_body/post/response_for_200.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_boolean_type_matches_booleans_request_body/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_boolean_type_matches_booleans_request_body/post.py deleted file mode 100644 index db22058d0fe..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_boolean_type_matches_booleans_request_body/post.py +++ /dev/null @@ -1,296 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from . import path - -# body param -SchemaForRequestBodyApplicationJson = schemas.BoolSchema - - -request_body_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) -_status_code_to_response = { - '200': _response_for_200, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _post_boolean_type_matches_booleans_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,bool, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_boolean_type_matches_booleans_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,bool, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_boolean_type_matches_booleans_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,bool, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_boolean_type_matches_booleans_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,bool, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_boolean_type_matches_booleans_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,bool, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostBooleanTypeMatchesBooleansRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_boolean_type_matches_booleans_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,bool, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_boolean_type_matches_booleans_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,bool, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_boolean_type_matches_booleans_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,bool, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_boolean_type_matches_booleans_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,bool, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_boolean_type_matches_booleans_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,bool, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_boolean_type_matches_booleans_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,bool, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,bool, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,bool, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,bool, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,bool, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_boolean_type_matches_booleans_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_boolean_type_matches_booleans_request_body/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_boolean_type_matches_booleans_request_body/post.pyi deleted file mode 100644 index b30d7be40c5..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_boolean_type_matches_booleans_request_body/post.pyi +++ /dev/null @@ -1,291 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -# body param -SchemaForRequestBodyApplicationJson = schemas.BoolSchema - - -request_body_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_boolean_type_matches_booleans_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,bool, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_boolean_type_matches_booleans_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,bool, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_boolean_type_matches_booleans_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,bool, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_boolean_type_matches_booleans_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,bool, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_boolean_type_matches_booleans_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,bool, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostBooleanTypeMatchesBooleansRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_boolean_type_matches_booleans_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,bool, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_boolean_type_matches_booleans_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,bool, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_boolean_type_matches_booleans_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,bool, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_boolean_type_matches_booleans_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,bool, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_boolean_type_matches_booleans_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,bool, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_boolean_type_matches_booleans_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,bool, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,bool, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,bool, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,bool, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,bool, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_boolean_type_matches_booleans_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_boolean_type_matches_booleans_request_body/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_boolean_type_matches_booleans_request_body/post/__init__.py new file mode 100644 index 00000000000..c4515ab8d82 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_boolean_type_matches_booleans_request_body/post/__init__.py @@ -0,0 +1,291 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.boolean_type_matches_booleans import BooleanTypeMatchesBooleans + +from .. import path +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = BooleanTypeMatchesBooleans + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + +_status_code_to_response = { + '200': response_for_200.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _post_boolean_type_matches_booleans_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_boolean_type_matches_booleans_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_boolean_type_matches_booleans_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_boolean_type_matches_booleans_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_boolean_type_matches_booleans_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostBooleanTypeMatchesBooleansRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_boolean_type_matches_booleans_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_boolean_type_matches_booleans_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_boolean_type_matches_booleans_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_boolean_type_matches_booleans_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_boolean_type_matches_booleans_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_boolean_type_matches_booleans_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_boolean_type_matches_booleans_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_boolean_type_matches_booleans_request_body/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_boolean_type_matches_booleans_request_body/post/__init__.pyi new file mode 100644 index 00000000000..c7ddbbad910 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_boolean_type_matches_booleans_request_body/post/__init__.pyi @@ -0,0 +1,286 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.boolean_type_matches_booleans import BooleanTypeMatchesBooleans + +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = BooleanTypeMatchesBooleans + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_boolean_type_matches_booleans_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_boolean_type_matches_booleans_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_boolean_type_matches_booleans_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_boolean_type_matches_booleans_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_boolean_type_matches_booleans_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostBooleanTypeMatchesBooleansRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_boolean_type_matches_booleans_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_boolean_type_matches_booleans_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_boolean_type_matches_booleans_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_boolean_type_matches_booleans_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_boolean_type_matches_booleans_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_boolean_type_matches_booleans_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_boolean_type_matches_booleans_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_boolean_type_matches_booleans_request_body/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_boolean_type_matches_booleans_request_body/post/response_for_200.py new file mode 100644 index 00000000000..ce057133be3 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_boolean_type_matches_booleans_request_body/post/response_for_200.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_by_int_request_body/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_by_int_request_body/post.py deleted file mode 100644 index 5d69029a348..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_by_int_request_body/post.py +++ /dev/null @@ -1,298 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.by_int import ByInt - -from . import path - -# body param -SchemaForRequestBodyApplicationJson = ByInt - - -request_body_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) -_status_code_to_response = { - '200': _response_for_200, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _post_by_int_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_by_int_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_by_int_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_by_int_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_by_int_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostByIntRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_by_int_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_by_int_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_by_int_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_by_int_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_by_int_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_by_int_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_by_int_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_by_int_request_body/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_by_int_request_body/post.pyi deleted file mode 100644 index 599b4979b68..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_by_int_request_body/post.pyi +++ /dev/null @@ -1,293 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.by_int import ByInt - -# body param -SchemaForRequestBodyApplicationJson = ByInt - - -request_body_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_by_int_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_by_int_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_by_int_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_by_int_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_by_int_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostByIntRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_by_int_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_by_int_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_by_int_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_by_int_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_by_int_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_by_int_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_by_int_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_by_int_request_body/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_by_int_request_body/post/__init__.py new file mode 100644 index 00000000000..c5728aa9745 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_by_int_request_body/post/__init__.py @@ -0,0 +1,291 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.by_int import ByInt + +from .. import path +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = ByInt + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + +_status_code_to_response = { + '200': response_for_200.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _post_by_int_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_by_int_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_by_int_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_by_int_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_by_int_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostByIntRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_by_int_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_by_int_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_by_int_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_by_int_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_by_int_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_by_int_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_by_int_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_by_int_request_body/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_by_int_request_body/post/__init__.pyi new file mode 100644 index 00000000000..779c7a3c633 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_by_int_request_body/post/__init__.pyi @@ -0,0 +1,286 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.by_int import ByInt + +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = ByInt + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_by_int_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_by_int_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_by_int_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_by_int_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_by_int_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostByIntRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_by_int_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_by_int_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_by_int_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_by_int_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_by_int_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_by_int_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_by_int_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_by_int_request_body/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_by_int_request_body/post/response_for_200.py new file mode 100644 index 00000000000..ce057133be3 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_by_int_request_body/post/response_for_200.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_by_number_request_body/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_by_number_request_body/post.py deleted file mode 100644 index 8e84300e738..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_by_number_request_body/post.py +++ /dev/null @@ -1,298 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.by_number import ByNumber - -from . import path - -# body param -SchemaForRequestBodyApplicationJson = ByNumber - - -request_body_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) -_status_code_to_response = { - '200': _response_for_200, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _post_by_number_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_by_number_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_by_number_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_by_number_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_by_number_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostByNumberRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_by_number_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_by_number_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_by_number_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_by_number_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_by_number_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_by_number_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_by_number_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_by_number_request_body/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_by_number_request_body/post.pyi deleted file mode 100644 index 2965ae19194..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_by_number_request_body/post.pyi +++ /dev/null @@ -1,293 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.by_number import ByNumber - -# body param -SchemaForRequestBodyApplicationJson = ByNumber - - -request_body_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_by_number_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_by_number_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_by_number_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_by_number_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_by_number_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostByNumberRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_by_number_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_by_number_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_by_number_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_by_number_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_by_number_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_by_number_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_by_number_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_by_number_request_body/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_by_number_request_body/post/__init__.py new file mode 100644 index 00000000000..63337a0e311 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_by_number_request_body/post/__init__.py @@ -0,0 +1,291 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.by_number import ByNumber + +from .. import path +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = ByNumber + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + +_status_code_to_response = { + '200': response_for_200.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _post_by_number_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_by_number_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_by_number_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_by_number_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_by_number_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostByNumberRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_by_number_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_by_number_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_by_number_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_by_number_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_by_number_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_by_number_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_by_number_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_by_number_request_body/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_by_number_request_body/post/__init__.pyi new file mode 100644 index 00000000000..f4b51559749 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_by_number_request_body/post/__init__.pyi @@ -0,0 +1,286 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.by_number import ByNumber + +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = ByNumber + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_by_number_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_by_number_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_by_number_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_by_number_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_by_number_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostByNumberRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_by_number_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_by_number_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_by_number_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_by_number_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_by_number_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_by_number_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_by_number_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_by_number_request_body/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_by_number_request_body/post/response_for_200.py new file mode 100644 index 00000000000..ce057133be3 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_by_number_request_body/post/response_for_200.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_by_small_number_request_body/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_by_small_number_request_body/post.py deleted file mode 100644 index 668ee59186b..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_by_small_number_request_body/post.py +++ /dev/null @@ -1,298 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.by_small_number import BySmallNumber - -from . import path - -# body param -SchemaForRequestBodyApplicationJson = BySmallNumber - - -request_body_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) -_status_code_to_response = { - '200': _response_for_200, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _post_by_small_number_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_by_small_number_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_by_small_number_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_by_small_number_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_by_small_number_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostBySmallNumberRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_by_small_number_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_by_small_number_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_by_small_number_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_by_small_number_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_by_small_number_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_by_small_number_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_by_small_number_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_by_small_number_request_body/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_by_small_number_request_body/post.pyi deleted file mode 100644 index adc387a8ea6..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_by_small_number_request_body/post.pyi +++ /dev/null @@ -1,293 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.by_small_number import BySmallNumber - -# body param -SchemaForRequestBodyApplicationJson = BySmallNumber - - -request_body_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_by_small_number_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_by_small_number_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_by_small_number_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_by_small_number_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_by_small_number_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostBySmallNumberRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_by_small_number_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_by_small_number_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_by_small_number_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_by_small_number_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_by_small_number_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_by_small_number_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_by_small_number_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_by_small_number_request_body/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_by_small_number_request_body/post/__init__.py new file mode 100644 index 00000000000..22a3538a8f2 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_by_small_number_request_body/post/__init__.py @@ -0,0 +1,291 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.by_small_number import BySmallNumber + +from .. import path +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = BySmallNumber + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + +_status_code_to_response = { + '200': response_for_200.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _post_by_small_number_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_by_small_number_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_by_small_number_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_by_small_number_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_by_small_number_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostBySmallNumberRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_by_small_number_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_by_small_number_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_by_small_number_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_by_small_number_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_by_small_number_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_by_small_number_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_by_small_number_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_by_small_number_request_body/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_by_small_number_request_body/post/__init__.pyi new file mode 100644 index 00000000000..fa8c887228f --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_by_small_number_request_body/post/__init__.pyi @@ -0,0 +1,286 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.by_small_number import BySmallNumber + +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = BySmallNumber + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_by_small_number_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_by_small_number_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_by_small_number_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_by_small_number_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_by_small_number_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostBySmallNumberRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_by_small_number_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_by_small_number_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_by_small_number_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_by_small_number_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_by_small_number_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_by_small_number_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_by_small_number_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_by_small_number_request_body/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_by_small_number_request_body/post/response_for_200.py new file mode 100644 index 00000000000..ce057133be3 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_by_small_number_request_body/post/response_for_200.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_date_time_format_request_body/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_date_time_format_request_body/post.py deleted file mode 100644 index 9499c4998d1..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_date_time_format_request_body/post.py +++ /dev/null @@ -1,319 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from . import path - -# body param - - -class SchemaForRequestBodyApplicationJson( - schemas.DateTimeBase, - schemas.AnyTypeSchema, -): - - - class MetaOapg: - format = 'date-time' - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'SchemaForRequestBodyApplicationJson': - return super().__new__( - cls, - *args, - _configuration=_configuration, - **kwargs, - ) - - -request_body_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) -_status_code_to_response = { - '200': _response_for_200, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _post_date_time_format_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_date_time_format_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_date_time_format_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_date_time_format_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_date_time_format_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostDateTimeFormatRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_date_time_format_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_date_time_format_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_date_time_format_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_date_time_format_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_date_time_format_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_date_time_format_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_date_time_format_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_date_time_format_request_body/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_date_time_format_request_body/post.pyi deleted file mode 100644 index e75c82d05ca..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_date_time_format_request_body/post.pyi +++ /dev/null @@ -1,314 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -# body param - - -class SchemaForRequestBodyApplicationJson( - schemas.DateTimeBase, - schemas.AnyTypeSchema, -): - - - class MetaOapg: - format = 'date-time' - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'SchemaForRequestBodyApplicationJson': - return super().__new__( - cls, - *args, - _configuration=_configuration, - **kwargs, - ) - - -request_body_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_date_time_format_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_date_time_format_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_date_time_format_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_date_time_format_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_date_time_format_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostDateTimeFormatRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_date_time_format_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_date_time_format_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_date_time_format_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_date_time_format_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_date_time_format_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_date_time_format_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_date_time_format_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_date_time_format_request_body/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_date_time_format_request_body/post/__init__.py new file mode 100644 index 00000000000..712a9031912 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_date_time_format_request_body/post/__init__.py @@ -0,0 +1,291 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.date_time_format import DateTimeFormat + +from .. import path +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = DateTimeFormat + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + +_status_code_to_response = { + '200': response_for_200.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _post_date_time_format_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_date_time_format_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_date_time_format_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_date_time_format_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_date_time_format_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostDateTimeFormatRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_date_time_format_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_date_time_format_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_date_time_format_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_date_time_format_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_date_time_format_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_date_time_format_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_date_time_format_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_date_time_format_request_body/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_date_time_format_request_body/post/__init__.pyi new file mode 100644 index 00000000000..08a362c02df --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_date_time_format_request_body/post/__init__.pyi @@ -0,0 +1,286 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.date_time_format import DateTimeFormat + +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = DateTimeFormat + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_date_time_format_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_date_time_format_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_date_time_format_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_date_time_format_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_date_time_format_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostDateTimeFormatRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_date_time_format_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_date_time_format_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_date_time_format_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_date_time_format_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_date_time_format_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_date_time_format_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_date_time_format_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_date_time_format_request_body/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_date_time_format_request_body/post/response_for_200.py new file mode 100644 index 00000000000..ce057133be3 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_date_time_format_request_body/post/response_for_200.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_email_format_request_body/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_email_format_request_body/post.py deleted file mode 100644 index 61c0e558b28..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_email_format_request_body/post.py +++ /dev/null @@ -1,318 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from . import path - -# body param - - -class SchemaForRequestBodyApplicationJson( - schemas.AnyTypeSchema, -): - - - class MetaOapg: - format = 'email' - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'SchemaForRequestBodyApplicationJson': - return super().__new__( - cls, - *args, - _configuration=_configuration, - **kwargs, - ) - - -request_body_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) -_status_code_to_response = { - '200': _response_for_200, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _post_email_format_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_email_format_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_email_format_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_email_format_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_email_format_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostEmailFormatRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_email_format_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_email_format_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_email_format_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_email_format_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_email_format_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_email_format_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_email_format_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_email_format_request_body/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_email_format_request_body/post.pyi deleted file mode 100644 index 624a2c83bd0..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_email_format_request_body/post.pyi +++ /dev/null @@ -1,313 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -# body param - - -class SchemaForRequestBodyApplicationJson( - schemas.AnyTypeSchema, -): - - - class MetaOapg: - format = 'email' - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'SchemaForRequestBodyApplicationJson': - return super().__new__( - cls, - *args, - _configuration=_configuration, - **kwargs, - ) - - -request_body_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_email_format_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_email_format_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_email_format_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_email_format_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_email_format_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostEmailFormatRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_email_format_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_email_format_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_email_format_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_email_format_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_email_format_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_email_format_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_email_format_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_email_format_request_body/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_email_format_request_body/post/__init__.py new file mode 100644 index 00000000000..747c4fd4a96 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_email_format_request_body/post/__init__.py @@ -0,0 +1,291 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.email_format import EmailFormat + +from .. import path +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = EmailFormat + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + +_status_code_to_response = { + '200': response_for_200.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _post_email_format_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_email_format_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_email_format_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_email_format_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_email_format_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostEmailFormatRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_email_format_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_email_format_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_email_format_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_email_format_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_email_format_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_email_format_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_email_format_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_email_format_request_body/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_email_format_request_body/post/__init__.pyi new file mode 100644 index 00000000000..2fa69c0b64c --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_email_format_request_body/post/__init__.pyi @@ -0,0 +1,286 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.email_format import EmailFormat + +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = EmailFormat + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_email_format_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_email_format_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_email_format_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_email_format_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_email_format_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostEmailFormatRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_email_format_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_email_format_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_email_format_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_email_format_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_email_format_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_email_format_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_email_format_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_email_format_request_body/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_email_format_request_body/post/response_for_200.py new file mode 100644 index 00000000000..ce057133be3 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_email_format_request_body/post/response_for_200.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_enum_with0_does_not_match_false_request_body/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_enum_with0_does_not_match_false_request_body/post.py deleted file mode 100644 index 1d6fde1b757..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_enum_with0_does_not_match_false_request_body/post.py +++ /dev/null @@ -1,298 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.enum_with0_does_not_match_false import EnumWith0DoesNotMatchFalse - -from . import path - -# body param -SchemaForRequestBodyApplicationJson = EnumWith0DoesNotMatchFalse - - -request_body_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) -_status_code_to_response = { - '200': _response_for_200, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _post_enum_with0_does_not_match_false_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_enum_with0_does_not_match_false_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_enum_with0_does_not_match_false_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_enum_with0_does_not_match_false_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_enum_with0_does_not_match_false_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostEnumWith0DoesNotMatchFalseRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_enum_with0_does_not_match_false_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_enum_with0_does_not_match_false_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_enum_with0_does_not_match_false_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_enum_with0_does_not_match_false_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_enum_with0_does_not_match_false_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_enum_with0_does_not_match_false_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_enum_with0_does_not_match_false_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_enum_with0_does_not_match_false_request_body/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_enum_with0_does_not_match_false_request_body/post.pyi deleted file mode 100644 index fc3b37cec26..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_enum_with0_does_not_match_false_request_body/post.pyi +++ /dev/null @@ -1,293 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.enum_with0_does_not_match_false import EnumWith0DoesNotMatchFalse - -# body param -SchemaForRequestBodyApplicationJson = EnumWith0DoesNotMatchFalse - - -request_body_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_enum_with0_does_not_match_false_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_enum_with0_does_not_match_false_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_enum_with0_does_not_match_false_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_enum_with0_does_not_match_false_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_enum_with0_does_not_match_false_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostEnumWith0DoesNotMatchFalseRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_enum_with0_does_not_match_false_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_enum_with0_does_not_match_false_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_enum_with0_does_not_match_false_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_enum_with0_does_not_match_false_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_enum_with0_does_not_match_false_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_enum_with0_does_not_match_false_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_enum_with0_does_not_match_false_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_enum_with0_does_not_match_false_request_body/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_enum_with0_does_not_match_false_request_body/post/__init__.py new file mode 100644 index 00000000000..263f563ab26 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_enum_with0_does_not_match_false_request_body/post/__init__.py @@ -0,0 +1,291 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.enum_with0_does_not_match_false import EnumWith0DoesNotMatchFalse + +from .. import path +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = EnumWith0DoesNotMatchFalse + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + +_status_code_to_response = { + '200': response_for_200.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _post_enum_with0_does_not_match_false_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_enum_with0_does_not_match_false_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_enum_with0_does_not_match_false_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_enum_with0_does_not_match_false_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_enum_with0_does_not_match_false_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostEnumWith0DoesNotMatchFalseRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_enum_with0_does_not_match_false_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_enum_with0_does_not_match_false_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_enum_with0_does_not_match_false_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_enum_with0_does_not_match_false_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_enum_with0_does_not_match_false_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_enum_with0_does_not_match_false_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_enum_with0_does_not_match_false_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_enum_with0_does_not_match_false_request_body/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_enum_with0_does_not_match_false_request_body/post/__init__.pyi new file mode 100644 index 00000000000..d22e31a208f --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_enum_with0_does_not_match_false_request_body/post/__init__.pyi @@ -0,0 +1,286 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.enum_with0_does_not_match_false import EnumWith0DoesNotMatchFalse + +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = EnumWith0DoesNotMatchFalse + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_enum_with0_does_not_match_false_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_enum_with0_does_not_match_false_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_enum_with0_does_not_match_false_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_enum_with0_does_not_match_false_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_enum_with0_does_not_match_false_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostEnumWith0DoesNotMatchFalseRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_enum_with0_does_not_match_false_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_enum_with0_does_not_match_false_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_enum_with0_does_not_match_false_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_enum_with0_does_not_match_false_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_enum_with0_does_not_match_false_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_enum_with0_does_not_match_false_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_enum_with0_does_not_match_false_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_enum_with0_does_not_match_false_request_body/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_enum_with0_does_not_match_false_request_body/post/response_for_200.py new file mode 100644 index 00000000000..ce057133be3 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_enum_with0_does_not_match_false_request_body/post/response_for_200.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_enum_with1_does_not_match_true_request_body/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_enum_with1_does_not_match_true_request_body/post.py deleted file mode 100644 index e54e98dc389..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_enum_with1_does_not_match_true_request_body/post.py +++ /dev/null @@ -1,298 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.enum_with1_does_not_match_true import EnumWith1DoesNotMatchTrue - -from . import path - -# body param -SchemaForRequestBodyApplicationJson = EnumWith1DoesNotMatchTrue - - -request_body_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) -_status_code_to_response = { - '200': _response_for_200, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _post_enum_with1_does_not_match_true_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_enum_with1_does_not_match_true_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_enum_with1_does_not_match_true_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_enum_with1_does_not_match_true_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_enum_with1_does_not_match_true_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostEnumWith1DoesNotMatchTrueRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_enum_with1_does_not_match_true_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_enum_with1_does_not_match_true_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_enum_with1_does_not_match_true_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_enum_with1_does_not_match_true_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_enum_with1_does_not_match_true_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_enum_with1_does_not_match_true_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_enum_with1_does_not_match_true_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_enum_with1_does_not_match_true_request_body/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_enum_with1_does_not_match_true_request_body/post.pyi deleted file mode 100644 index 5dfa978e1f2..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_enum_with1_does_not_match_true_request_body/post.pyi +++ /dev/null @@ -1,293 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.enum_with1_does_not_match_true import EnumWith1DoesNotMatchTrue - -# body param -SchemaForRequestBodyApplicationJson = EnumWith1DoesNotMatchTrue - - -request_body_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_enum_with1_does_not_match_true_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_enum_with1_does_not_match_true_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_enum_with1_does_not_match_true_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_enum_with1_does_not_match_true_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_enum_with1_does_not_match_true_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostEnumWith1DoesNotMatchTrueRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_enum_with1_does_not_match_true_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_enum_with1_does_not_match_true_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_enum_with1_does_not_match_true_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_enum_with1_does_not_match_true_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_enum_with1_does_not_match_true_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_enum_with1_does_not_match_true_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_enum_with1_does_not_match_true_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_enum_with1_does_not_match_true_request_body/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_enum_with1_does_not_match_true_request_body/post/__init__.py new file mode 100644 index 00000000000..355c141e466 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_enum_with1_does_not_match_true_request_body/post/__init__.py @@ -0,0 +1,291 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.enum_with1_does_not_match_true import EnumWith1DoesNotMatchTrue + +from .. import path +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = EnumWith1DoesNotMatchTrue + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + +_status_code_to_response = { + '200': response_for_200.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _post_enum_with1_does_not_match_true_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_enum_with1_does_not_match_true_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_enum_with1_does_not_match_true_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_enum_with1_does_not_match_true_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_enum_with1_does_not_match_true_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostEnumWith1DoesNotMatchTrueRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_enum_with1_does_not_match_true_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_enum_with1_does_not_match_true_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_enum_with1_does_not_match_true_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_enum_with1_does_not_match_true_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_enum_with1_does_not_match_true_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_enum_with1_does_not_match_true_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_enum_with1_does_not_match_true_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_enum_with1_does_not_match_true_request_body/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_enum_with1_does_not_match_true_request_body/post/__init__.pyi new file mode 100644 index 00000000000..7ace200fb6f --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_enum_with1_does_not_match_true_request_body/post/__init__.pyi @@ -0,0 +1,286 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.enum_with1_does_not_match_true import EnumWith1DoesNotMatchTrue + +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = EnumWith1DoesNotMatchTrue + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_enum_with1_does_not_match_true_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_enum_with1_does_not_match_true_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_enum_with1_does_not_match_true_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_enum_with1_does_not_match_true_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_enum_with1_does_not_match_true_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostEnumWith1DoesNotMatchTrueRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_enum_with1_does_not_match_true_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_enum_with1_does_not_match_true_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_enum_with1_does_not_match_true_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_enum_with1_does_not_match_true_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_enum_with1_does_not_match_true_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_enum_with1_does_not_match_true_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_enum_with1_does_not_match_true_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_enum_with1_does_not_match_true_request_body/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_enum_with1_does_not_match_true_request_body/post/response_for_200.py new file mode 100644 index 00000000000..ce057133be3 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_enum_with1_does_not_match_true_request_body/post/response_for_200.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_enum_with_escaped_characters_request_body/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_enum_with_escaped_characters_request_body/post.py deleted file mode 100644 index abf4252d662..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_enum_with_escaped_characters_request_body/post.py +++ /dev/null @@ -1,298 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.enum_with_escaped_characters import EnumWithEscapedCharacters - -from . import path - -# body param -SchemaForRequestBodyApplicationJson = EnumWithEscapedCharacters - - -request_body_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) -_status_code_to_response = { - '200': _response_for_200, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _post_enum_with_escaped_characters_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_enum_with_escaped_characters_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_enum_with_escaped_characters_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_enum_with_escaped_characters_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_enum_with_escaped_characters_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostEnumWithEscapedCharactersRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_enum_with_escaped_characters_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_enum_with_escaped_characters_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_enum_with_escaped_characters_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_enum_with_escaped_characters_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_enum_with_escaped_characters_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_enum_with_escaped_characters_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_enum_with_escaped_characters_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_enum_with_escaped_characters_request_body/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_enum_with_escaped_characters_request_body/post.pyi deleted file mode 100644 index ae3cd9c56a5..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_enum_with_escaped_characters_request_body/post.pyi +++ /dev/null @@ -1,293 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.enum_with_escaped_characters import EnumWithEscapedCharacters - -# body param -SchemaForRequestBodyApplicationJson = EnumWithEscapedCharacters - - -request_body_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_enum_with_escaped_characters_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_enum_with_escaped_characters_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_enum_with_escaped_characters_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_enum_with_escaped_characters_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_enum_with_escaped_characters_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostEnumWithEscapedCharactersRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_enum_with_escaped_characters_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_enum_with_escaped_characters_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_enum_with_escaped_characters_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_enum_with_escaped_characters_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_enum_with_escaped_characters_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_enum_with_escaped_characters_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_enum_with_escaped_characters_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_enum_with_escaped_characters_request_body/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_enum_with_escaped_characters_request_body/post/__init__.py new file mode 100644 index 00000000000..25b4a9655b7 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_enum_with_escaped_characters_request_body/post/__init__.py @@ -0,0 +1,291 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.enum_with_escaped_characters import EnumWithEscapedCharacters + +from .. import path +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = EnumWithEscapedCharacters + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + +_status_code_to_response = { + '200': response_for_200.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _post_enum_with_escaped_characters_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_enum_with_escaped_characters_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_enum_with_escaped_characters_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_enum_with_escaped_characters_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_enum_with_escaped_characters_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostEnumWithEscapedCharactersRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_enum_with_escaped_characters_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_enum_with_escaped_characters_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_enum_with_escaped_characters_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_enum_with_escaped_characters_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_enum_with_escaped_characters_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_enum_with_escaped_characters_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_enum_with_escaped_characters_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_enum_with_escaped_characters_request_body/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_enum_with_escaped_characters_request_body/post/__init__.pyi new file mode 100644 index 00000000000..7dfa44fe938 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_enum_with_escaped_characters_request_body/post/__init__.pyi @@ -0,0 +1,286 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.enum_with_escaped_characters import EnumWithEscapedCharacters + +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = EnumWithEscapedCharacters + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_enum_with_escaped_characters_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_enum_with_escaped_characters_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_enum_with_escaped_characters_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_enum_with_escaped_characters_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_enum_with_escaped_characters_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostEnumWithEscapedCharactersRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_enum_with_escaped_characters_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_enum_with_escaped_characters_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_enum_with_escaped_characters_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_enum_with_escaped_characters_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_enum_with_escaped_characters_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_enum_with_escaped_characters_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_enum_with_escaped_characters_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_enum_with_escaped_characters_request_body/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_enum_with_escaped_characters_request_body/post/response_for_200.py new file mode 100644 index 00000000000..ce057133be3 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_enum_with_escaped_characters_request_body/post/response_for_200.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_enum_with_false_does_not_match0_request_body/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_enum_with_false_does_not_match0_request_body/post.py deleted file mode 100644 index f13496bc396..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_enum_with_false_does_not_match0_request_body/post.py +++ /dev/null @@ -1,298 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.enum_with_false_does_not_match0 import EnumWithFalseDoesNotMatch0 - -from . import path - -# body param -SchemaForRequestBodyApplicationJson = EnumWithFalseDoesNotMatch0 - - -request_body_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) -_status_code_to_response = { - '200': _response_for_200, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _post_enum_with_false_does_not_match0_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_enum_with_false_does_not_match0_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_enum_with_false_does_not_match0_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_enum_with_false_does_not_match0_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_enum_with_false_does_not_match0_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostEnumWithFalseDoesNotMatch0RequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_enum_with_false_does_not_match0_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_enum_with_false_does_not_match0_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_enum_with_false_does_not_match0_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_enum_with_false_does_not_match0_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_enum_with_false_does_not_match0_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_enum_with_false_does_not_match0_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_enum_with_false_does_not_match0_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_enum_with_false_does_not_match0_request_body/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_enum_with_false_does_not_match0_request_body/post.pyi deleted file mode 100644 index d2a2fb5b1a7..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_enum_with_false_does_not_match0_request_body/post.pyi +++ /dev/null @@ -1,293 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.enum_with_false_does_not_match0 import EnumWithFalseDoesNotMatch0 - -# body param -SchemaForRequestBodyApplicationJson = EnumWithFalseDoesNotMatch0 - - -request_body_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_enum_with_false_does_not_match0_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_enum_with_false_does_not_match0_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_enum_with_false_does_not_match0_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_enum_with_false_does_not_match0_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_enum_with_false_does_not_match0_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostEnumWithFalseDoesNotMatch0RequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_enum_with_false_does_not_match0_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_enum_with_false_does_not_match0_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_enum_with_false_does_not_match0_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_enum_with_false_does_not_match0_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_enum_with_false_does_not_match0_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_enum_with_false_does_not_match0_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_enum_with_false_does_not_match0_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_enum_with_false_does_not_match0_request_body/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_enum_with_false_does_not_match0_request_body/post/__init__.py new file mode 100644 index 00000000000..e312bad827c --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_enum_with_false_does_not_match0_request_body/post/__init__.py @@ -0,0 +1,291 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.enum_with_false_does_not_match0 import EnumWithFalseDoesNotMatch0 + +from .. import path +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = EnumWithFalseDoesNotMatch0 + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + +_status_code_to_response = { + '200': response_for_200.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _post_enum_with_false_does_not_match0_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_enum_with_false_does_not_match0_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_enum_with_false_does_not_match0_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_enum_with_false_does_not_match0_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_enum_with_false_does_not_match0_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostEnumWithFalseDoesNotMatch0RequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_enum_with_false_does_not_match0_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_enum_with_false_does_not_match0_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_enum_with_false_does_not_match0_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_enum_with_false_does_not_match0_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_enum_with_false_does_not_match0_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_enum_with_false_does_not_match0_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_enum_with_false_does_not_match0_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_enum_with_false_does_not_match0_request_body/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_enum_with_false_does_not_match0_request_body/post/__init__.pyi new file mode 100644 index 00000000000..56971de21c3 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_enum_with_false_does_not_match0_request_body/post/__init__.pyi @@ -0,0 +1,286 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.enum_with_false_does_not_match0 import EnumWithFalseDoesNotMatch0 + +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = EnumWithFalseDoesNotMatch0 + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_enum_with_false_does_not_match0_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_enum_with_false_does_not_match0_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_enum_with_false_does_not_match0_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_enum_with_false_does_not_match0_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_enum_with_false_does_not_match0_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostEnumWithFalseDoesNotMatch0RequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_enum_with_false_does_not_match0_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_enum_with_false_does_not_match0_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_enum_with_false_does_not_match0_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_enum_with_false_does_not_match0_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_enum_with_false_does_not_match0_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_enum_with_false_does_not_match0_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_enum_with_false_does_not_match0_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_enum_with_false_does_not_match0_request_body/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_enum_with_false_does_not_match0_request_body/post/response_for_200.py new file mode 100644 index 00000000000..ce057133be3 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_enum_with_false_does_not_match0_request_body/post/response_for_200.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_enum_with_true_does_not_match1_request_body/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_enum_with_true_does_not_match1_request_body/post.py deleted file mode 100644 index cdda0d34c52..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_enum_with_true_does_not_match1_request_body/post.py +++ /dev/null @@ -1,298 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.enum_with_true_does_not_match1 import EnumWithTrueDoesNotMatch1 - -from . import path - -# body param -SchemaForRequestBodyApplicationJson = EnumWithTrueDoesNotMatch1 - - -request_body_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) -_status_code_to_response = { - '200': _response_for_200, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _post_enum_with_true_does_not_match1_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_enum_with_true_does_not_match1_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_enum_with_true_does_not_match1_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_enum_with_true_does_not_match1_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_enum_with_true_does_not_match1_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostEnumWithTrueDoesNotMatch1RequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_enum_with_true_does_not_match1_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_enum_with_true_does_not_match1_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_enum_with_true_does_not_match1_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_enum_with_true_does_not_match1_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_enum_with_true_does_not_match1_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_enum_with_true_does_not_match1_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_enum_with_true_does_not_match1_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_enum_with_true_does_not_match1_request_body/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_enum_with_true_does_not_match1_request_body/post.pyi deleted file mode 100644 index ede86715a92..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_enum_with_true_does_not_match1_request_body/post.pyi +++ /dev/null @@ -1,293 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.enum_with_true_does_not_match1 import EnumWithTrueDoesNotMatch1 - -# body param -SchemaForRequestBodyApplicationJson = EnumWithTrueDoesNotMatch1 - - -request_body_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_enum_with_true_does_not_match1_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_enum_with_true_does_not_match1_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_enum_with_true_does_not_match1_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_enum_with_true_does_not_match1_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_enum_with_true_does_not_match1_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostEnumWithTrueDoesNotMatch1RequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_enum_with_true_does_not_match1_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_enum_with_true_does_not_match1_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_enum_with_true_does_not_match1_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_enum_with_true_does_not_match1_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_enum_with_true_does_not_match1_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_enum_with_true_does_not_match1_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_enum_with_true_does_not_match1_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_enum_with_true_does_not_match1_request_body/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_enum_with_true_does_not_match1_request_body/post/__init__.py new file mode 100644 index 00000000000..f82df3450ac --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_enum_with_true_does_not_match1_request_body/post/__init__.py @@ -0,0 +1,291 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.enum_with_true_does_not_match1 import EnumWithTrueDoesNotMatch1 + +from .. import path +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = EnumWithTrueDoesNotMatch1 + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + +_status_code_to_response = { + '200': response_for_200.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _post_enum_with_true_does_not_match1_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_enum_with_true_does_not_match1_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_enum_with_true_does_not_match1_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_enum_with_true_does_not_match1_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_enum_with_true_does_not_match1_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostEnumWithTrueDoesNotMatch1RequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_enum_with_true_does_not_match1_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_enum_with_true_does_not_match1_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_enum_with_true_does_not_match1_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_enum_with_true_does_not_match1_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_enum_with_true_does_not_match1_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_enum_with_true_does_not_match1_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_enum_with_true_does_not_match1_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_enum_with_true_does_not_match1_request_body/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_enum_with_true_does_not_match1_request_body/post/__init__.pyi new file mode 100644 index 00000000000..693914a8c52 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_enum_with_true_does_not_match1_request_body/post/__init__.pyi @@ -0,0 +1,286 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.enum_with_true_does_not_match1 import EnumWithTrueDoesNotMatch1 + +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = EnumWithTrueDoesNotMatch1 + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_enum_with_true_does_not_match1_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_enum_with_true_does_not_match1_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_enum_with_true_does_not_match1_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_enum_with_true_does_not_match1_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_enum_with_true_does_not_match1_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostEnumWithTrueDoesNotMatch1RequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_enum_with_true_does_not_match1_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_enum_with_true_does_not_match1_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_enum_with_true_does_not_match1_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_enum_with_true_does_not_match1_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_enum_with_true_does_not_match1_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_enum_with_true_does_not_match1_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_enum_with_true_does_not_match1_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_enum_with_true_does_not_match1_request_body/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_enum_with_true_does_not_match1_request_body/post/response_for_200.py new file mode 100644 index 00000000000..ce057133be3 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_enum_with_true_does_not_match1_request_body/post/response_for_200.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_enums_in_properties_request_body/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_enums_in_properties_request_body/post.py deleted file mode 100644 index dc053602f57..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_enums_in_properties_request_body/post.py +++ /dev/null @@ -1,298 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.enums_in_properties import EnumsInProperties - -from . import path - -# body param -SchemaForRequestBodyApplicationJson = EnumsInProperties - - -request_body_enums_in_properties = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) -_status_code_to_response = { - '200': _response_for_200, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _post_enums_in_properties_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_enums_in_properties_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_enums_in_properties_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_enums_in_properties_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_enums_in_properties_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_enums_in_properties.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostEnumsInPropertiesRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_enums_in_properties_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_enums_in_properties_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_enums_in_properties_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_enums_in_properties_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_enums_in_properties_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_enums_in_properties_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_enums_in_properties_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_enums_in_properties_request_body/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_enums_in_properties_request_body/post.pyi deleted file mode 100644 index 082bb8a018e..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_enums_in_properties_request_body/post.pyi +++ /dev/null @@ -1,293 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.enums_in_properties import EnumsInProperties - -# body param -SchemaForRequestBodyApplicationJson = EnumsInProperties - - -request_body_enums_in_properties = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_enums_in_properties_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_enums_in_properties_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_enums_in_properties_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_enums_in_properties_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_enums_in_properties_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_enums_in_properties.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostEnumsInPropertiesRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_enums_in_properties_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_enums_in_properties_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_enums_in_properties_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_enums_in_properties_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_enums_in_properties_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_enums_in_properties_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_enums_in_properties_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_enums_in_properties_request_body/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_enums_in_properties_request_body/post/__init__.py new file mode 100644 index 00000000000..4191a7652f6 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_enums_in_properties_request_body/post/__init__.py @@ -0,0 +1,291 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.enums_in_properties import EnumsInProperties + +from .. import path +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = EnumsInProperties + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + +_status_code_to_response = { + '200': response_for_200.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _post_enums_in_properties_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_enums_in_properties_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_enums_in_properties_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_enums_in_properties_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_enums_in_properties_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostEnumsInPropertiesRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_enums_in_properties_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_enums_in_properties_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_enums_in_properties_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_enums_in_properties_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_enums_in_properties_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_enums_in_properties_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_enums_in_properties_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_enums_in_properties_request_body/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_enums_in_properties_request_body/post/__init__.pyi new file mode 100644 index 00000000000..b0e52f289aa --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_enums_in_properties_request_body/post/__init__.pyi @@ -0,0 +1,286 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.enums_in_properties import EnumsInProperties + +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = EnumsInProperties + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_enums_in_properties_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_enums_in_properties_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_enums_in_properties_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_enums_in_properties_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_enums_in_properties_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostEnumsInPropertiesRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_enums_in_properties_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_enums_in_properties_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_enums_in_properties_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_enums_in_properties_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_enums_in_properties_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_enums_in_properties_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_enums_in_properties_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_enums_in_properties_request_body/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_enums_in_properties_request_body/post/response_for_200.py new file mode 100644 index 00000000000..ce057133be3 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_enums_in_properties_request_body/post/response_for_200.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_forbidden_property_request_body/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_forbidden_property_request_body/post.py deleted file mode 100644 index e1e44621625..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_forbidden_property_request_body/post.py +++ /dev/null @@ -1,298 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.forbidden_property import ForbiddenProperty - -from . import path - -# body param -SchemaForRequestBodyApplicationJson = ForbiddenProperty - - -request_body_forbidden_property = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) -_status_code_to_response = { - '200': _response_for_200, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _post_forbidden_property_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_forbidden_property_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_forbidden_property_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_forbidden_property_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_forbidden_property_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_forbidden_property.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostForbiddenPropertyRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_forbidden_property_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_forbidden_property_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_forbidden_property_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_forbidden_property_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_forbidden_property_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_forbidden_property_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_forbidden_property_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_forbidden_property_request_body/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_forbidden_property_request_body/post.pyi deleted file mode 100644 index 688fcb76f94..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_forbidden_property_request_body/post.pyi +++ /dev/null @@ -1,293 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.forbidden_property import ForbiddenProperty - -# body param -SchemaForRequestBodyApplicationJson = ForbiddenProperty - - -request_body_forbidden_property = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_forbidden_property_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_forbidden_property_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_forbidden_property_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_forbidden_property_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_forbidden_property_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_forbidden_property.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostForbiddenPropertyRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_forbidden_property_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_forbidden_property_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_forbidden_property_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_forbidden_property_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_forbidden_property_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_forbidden_property_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_forbidden_property_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_forbidden_property_request_body/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_forbidden_property_request_body/post/__init__.py new file mode 100644 index 00000000000..9b1744738a1 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_forbidden_property_request_body/post/__init__.py @@ -0,0 +1,291 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.forbidden_property import ForbiddenProperty + +from .. import path +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = ForbiddenProperty + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + +_status_code_to_response = { + '200': response_for_200.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _post_forbidden_property_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_forbidden_property_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_forbidden_property_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_forbidden_property_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_forbidden_property_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostForbiddenPropertyRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_forbidden_property_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_forbidden_property_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_forbidden_property_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_forbidden_property_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_forbidden_property_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_forbidden_property_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_forbidden_property_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_forbidden_property_request_body/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_forbidden_property_request_body/post/__init__.pyi new file mode 100644 index 00000000000..56769a5273c --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_forbidden_property_request_body/post/__init__.pyi @@ -0,0 +1,286 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.forbidden_property import ForbiddenProperty + +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = ForbiddenProperty + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_forbidden_property_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_forbidden_property_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_forbidden_property_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_forbidden_property_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_forbidden_property_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostForbiddenPropertyRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_forbidden_property_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_forbidden_property_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_forbidden_property_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_forbidden_property_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_forbidden_property_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_forbidden_property_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_forbidden_property_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_forbidden_property_request_body/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_forbidden_property_request_body/post/response_for_200.py new file mode 100644 index 00000000000..ce057133be3 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_forbidden_property_request_body/post/response_for_200.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_hostname_format_request_body/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_hostname_format_request_body/post.py deleted file mode 100644 index 531dc56c32a..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_hostname_format_request_body/post.py +++ /dev/null @@ -1,318 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from . import path - -# body param - - -class SchemaForRequestBodyApplicationJson( - schemas.AnyTypeSchema, -): - - - class MetaOapg: - format = 'hostname' - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'SchemaForRequestBodyApplicationJson': - return super().__new__( - cls, - *args, - _configuration=_configuration, - **kwargs, - ) - - -request_body_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) -_status_code_to_response = { - '200': _response_for_200, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _post_hostname_format_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_hostname_format_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_hostname_format_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_hostname_format_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_hostname_format_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostHostnameFormatRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_hostname_format_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_hostname_format_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_hostname_format_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_hostname_format_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_hostname_format_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_hostname_format_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_hostname_format_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_hostname_format_request_body/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_hostname_format_request_body/post.pyi deleted file mode 100644 index 96b59201e87..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_hostname_format_request_body/post.pyi +++ /dev/null @@ -1,313 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -# body param - - -class SchemaForRequestBodyApplicationJson( - schemas.AnyTypeSchema, -): - - - class MetaOapg: - format = 'hostname' - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'SchemaForRequestBodyApplicationJson': - return super().__new__( - cls, - *args, - _configuration=_configuration, - **kwargs, - ) - - -request_body_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_hostname_format_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_hostname_format_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_hostname_format_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_hostname_format_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_hostname_format_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostHostnameFormatRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_hostname_format_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_hostname_format_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_hostname_format_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_hostname_format_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_hostname_format_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_hostname_format_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_hostname_format_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_hostname_format_request_body/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_hostname_format_request_body/post/__init__.py new file mode 100644 index 00000000000..06ab0b855aa --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_hostname_format_request_body/post/__init__.py @@ -0,0 +1,291 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.hostname_format import HostnameFormat + +from .. import path +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = HostnameFormat + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + +_status_code_to_response = { + '200': response_for_200.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _post_hostname_format_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_hostname_format_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_hostname_format_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_hostname_format_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_hostname_format_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostHostnameFormatRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_hostname_format_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_hostname_format_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_hostname_format_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_hostname_format_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_hostname_format_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_hostname_format_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_hostname_format_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_hostname_format_request_body/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_hostname_format_request_body/post/__init__.pyi new file mode 100644 index 00000000000..a32120bcf46 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_hostname_format_request_body/post/__init__.pyi @@ -0,0 +1,286 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.hostname_format import HostnameFormat + +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = HostnameFormat + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_hostname_format_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_hostname_format_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_hostname_format_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_hostname_format_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_hostname_format_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostHostnameFormatRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_hostname_format_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_hostname_format_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_hostname_format_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_hostname_format_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_hostname_format_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_hostname_format_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_hostname_format_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_hostname_format_request_body/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_hostname_format_request_body/post/response_for_200.py new file mode 100644 index 00000000000..ce057133be3 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_hostname_format_request_body/post/response_for_200.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_integer_type_matches_integers_request_body/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_integer_type_matches_integers_request_body/post.py deleted file mode 100644 index 746839d1cdf..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_integer_type_matches_integers_request_body/post.py +++ /dev/null @@ -1,296 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from . import path - -# body param -SchemaForRequestBodyApplicationJson = schemas.IntSchema - - -request_body_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) -_status_code_to_response = { - '200': _response_for_200, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _post_integer_type_matches_integers_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,decimal.Decimal, int, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_integer_type_matches_integers_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,decimal.Decimal, int, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_integer_type_matches_integers_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,decimal.Decimal, int, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_integer_type_matches_integers_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,decimal.Decimal, int, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_integer_type_matches_integers_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,decimal.Decimal, int, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostIntegerTypeMatchesIntegersRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_integer_type_matches_integers_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,decimal.Decimal, int, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_integer_type_matches_integers_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,decimal.Decimal, int, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_integer_type_matches_integers_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,decimal.Decimal, int, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_integer_type_matches_integers_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,decimal.Decimal, int, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_integer_type_matches_integers_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,decimal.Decimal, int, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_integer_type_matches_integers_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,decimal.Decimal, int, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,decimal.Decimal, int, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,decimal.Decimal, int, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,decimal.Decimal, int, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,decimal.Decimal, int, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_integer_type_matches_integers_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_integer_type_matches_integers_request_body/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_integer_type_matches_integers_request_body/post.pyi deleted file mode 100644 index a2d00a4f70c..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_integer_type_matches_integers_request_body/post.pyi +++ /dev/null @@ -1,291 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -# body param -SchemaForRequestBodyApplicationJson = schemas.IntSchema - - -request_body_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_integer_type_matches_integers_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,decimal.Decimal, int, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_integer_type_matches_integers_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,decimal.Decimal, int, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_integer_type_matches_integers_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,decimal.Decimal, int, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_integer_type_matches_integers_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,decimal.Decimal, int, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_integer_type_matches_integers_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,decimal.Decimal, int, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostIntegerTypeMatchesIntegersRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_integer_type_matches_integers_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,decimal.Decimal, int, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_integer_type_matches_integers_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,decimal.Decimal, int, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_integer_type_matches_integers_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,decimal.Decimal, int, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_integer_type_matches_integers_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,decimal.Decimal, int, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_integer_type_matches_integers_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,decimal.Decimal, int, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_integer_type_matches_integers_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,decimal.Decimal, int, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,decimal.Decimal, int, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,decimal.Decimal, int, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,decimal.Decimal, int, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,decimal.Decimal, int, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_integer_type_matches_integers_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_integer_type_matches_integers_request_body/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_integer_type_matches_integers_request_body/post/__init__.py new file mode 100644 index 00000000000..4c90653670e --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_integer_type_matches_integers_request_body/post/__init__.py @@ -0,0 +1,291 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.integer_type_matches_integers import IntegerTypeMatchesIntegers + +from .. import path +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = IntegerTypeMatchesIntegers + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + +_status_code_to_response = { + '200': response_for_200.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _post_integer_type_matches_integers_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_integer_type_matches_integers_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_integer_type_matches_integers_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_integer_type_matches_integers_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_integer_type_matches_integers_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostIntegerTypeMatchesIntegersRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_integer_type_matches_integers_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_integer_type_matches_integers_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_integer_type_matches_integers_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_integer_type_matches_integers_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_integer_type_matches_integers_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_integer_type_matches_integers_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_integer_type_matches_integers_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_integer_type_matches_integers_request_body/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_integer_type_matches_integers_request_body/post/__init__.pyi new file mode 100644 index 00000000000..556d4aa5c3e --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_integer_type_matches_integers_request_body/post/__init__.pyi @@ -0,0 +1,286 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.integer_type_matches_integers import IntegerTypeMatchesIntegers + +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = IntegerTypeMatchesIntegers + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_integer_type_matches_integers_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_integer_type_matches_integers_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_integer_type_matches_integers_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_integer_type_matches_integers_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_integer_type_matches_integers_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostIntegerTypeMatchesIntegersRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_integer_type_matches_integers_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_integer_type_matches_integers_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_integer_type_matches_integers_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_integer_type_matches_integers_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_integer_type_matches_integers_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_integer_type_matches_integers_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_integer_type_matches_integers_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_integer_type_matches_integers_request_body/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_integer_type_matches_integers_request_body/post/response_for_200.py new file mode 100644 index 00000000000..ce057133be3 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_integer_type_matches_integers_request_body/post/response_for_200.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_invalid_instance_should_not_raise_error_when_float_division_inf_request_body/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_invalid_instance_should_not_raise_error_when_float_division_inf_request_body/post.py deleted file mode 100644 index a4373898774..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_invalid_instance_should_not_raise_error_when_float_division_inf_request_body/post.py +++ /dev/null @@ -1,298 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.invalid_instance_should_not_raise_error_when_float_division_inf import InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf - -from . import path - -# body param -SchemaForRequestBodyApplicationJson = InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf - - -request_body_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) -_status_code_to_response = { - '200': _response_for_200, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _post_invalid_instance_should_not_raise_error_when_float_division_inf_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_invalid_instance_should_not_raise_error_when_float_division_inf_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_invalid_instance_should_not_raise_error_when_float_division_inf_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_invalid_instance_should_not_raise_error_when_float_division_inf_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_invalid_instance_should_not_raise_error_when_float_division_inf_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostInvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInfRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_invalid_instance_should_not_raise_error_when_float_division_inf_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_invalid_instance_should_not_raise_error_when_float_division_inf_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_invalid_instance_should_not_raise_error_when_float_division_inf_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_invalid_instance_should_not_raise_error_when_float_division_inf_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_invalid_instance_should_not_raise_error_when_float_division_inf_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_invalid_instance_should_not_raise_error_when_float_division_inf_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_invalid_instance_should_not_raise_error_when_float_division_inf_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_invalid_instance_should_not_raise_error_when_float_division_inf_request_body/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_invalid_instance_should_not_raise_error_when_float_division_inf_request_body/post.pyi deleted file mode 100644 index 15c6c301222..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_invalid_instance_should_not_raise_error_when_float_division_inf_request_body/post.pyi +++ /dev/null @@ -1,293 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.invalid_instance_should_not_raise_error_when_float_division_inf import InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf - -# body param -SchemaForRequestBodyApplicationJson = InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf - - -request_body_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_invalid_instance_should_not_raise_error_when_float_division_inf_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_invalid_instance_should_not_raise_error_when_float_division_inf_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_invalid_instance_should_not_raise_error_when_float_division_inf_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_invalid_instance_should_not_raise_error_when_float_division_inf_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_invalid_instance_should_not_raise_error_when_float_division_inf_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostInvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInfRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_invalid_instance_should_not_raise_error_when_float_division_inf_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_invalid_instance_should_not_raise_error_when_float_division_inf_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_invalid_instance_should_not_raise_error_when_float_division_inf_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_invalid_instance_should_not_raise_error_when_float_division_inf_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_invalid_instance_should_not_raise_error_when_float_division_inf_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_invalid_instance_should_not_raise_error_when_float_division_inf_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_invalid_instance_should_not_raise_error_when_float_division_inf_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_invalid_instance_should_not_raise_error_when_float_division_inf_request_body/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_invalid_instance_should_not_raise_error_when_float_division_inf_request_body/post/__init__.py new file mode 100644 index 00000000000..2b80770abea --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_invalid_instance_should_not_raise_error_when_float_division_inf_request_body/post/__init__.py @@ -0,0 +1,291 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.invalid_instance_should_not_raise_error_when_float_division_inf import InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf + +from .. import path +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + +_status_code_to_response = { + '200': response_for_200.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _post_invalid_instance_should_not_raise_error_when_float_division_inf_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_invalid_instance_should_not_raise_error_when_float_division_inf_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_invalid_instance_should_not_raise_error_when_float_division_inf_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_invalid_instance_should_not_raise_error_when_float_division_inf_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_invalid_instance_should_not_raise_error_when_float_division_inf_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostInvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInfRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_invalid_instance_should_not_raise_error_when_float_division_inf_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_invalid_instance_should_not_raise_error_when_float_division_inf_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_invalid_instance_should_not_raise_error_when_float_division_inf_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_invalid_instance_should_not_raise_error_when_float_division_inf_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_invalid_instance_should_not_raise_error_when_float_division_inf_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_invalid_instance_should_not_raise_error_when_float_division_inf_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_invalid_instance_should_not_raise_error_when_float_division_inf_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_invalid_instance_should_not_raise_error_when_float_division_inf_request_body/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_invalid_instance_should_not_raise_error_when_float_division_inf_request_body/post/__init__.pyi new file mode 100644 index 00000000000..f349b81a003 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_invalid_instance_should_not_raise_error_when_float_division_inf_request_body/post/__init__.pyi @@ -0,0 +1,286 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.invalid_instance_should_not_raise_error_when_float_division_inf import InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf + +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_invalid_instance_should_not_raise_error_when_float_division_inf_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_invalid_instance_should_not_raise_error_when_float_division_inf_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_invalid_instance_should_not_raise_error_when_float_division_inf_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_invalid_instance_should_not_raise_error_when_float_division_inf_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_invalid_instance_should_not_raise_error_when_float_division_inf_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostInvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInfRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_invalid_instance_should_not_raise_error_when_float_division_inf_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_invalid_instance_should_not_raise_error_when_float_division_inf_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_invalid_instance_should_not_raise_error_when_float_division_inf_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_invalid_instance_should_not_raise_error_when_float_division_inf_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_invalid_instance_should_not_raise_error_when_float_division_inf_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_invalid_instance_should_not_raise_error_when_float_division_inf_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_invalid_instance_should_not_raise_error_when_float_division_inf_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_invalid_instance_should_not_raise_error_when_float_division_inf_request_body/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_invalid_instance_should_not_raise_error_when_float_division_inf_request_body/post/response_for_200.py new file mode 100644 index 00000000000..ce057133be3 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_invalid_instance_should_not_raise_error_when_float_division_inf_request_body/post/response_for_200.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_invalid_string_value_for_default_request_body/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_invalid_string_value_for_default_request_body/post.py deleted file mode 100644 index 27ac8568811..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_invalid_string_value_for_default_request_body/post.py +++ /dev/null @@ -1,298 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.invalid_string_value_for_default import InvalidStringValueForDefault - -from . import path - -# body param -SchemaForRequestBodyApplicationJson = InvalidStringValueForDefault - - -request_body_invalid_string_value_for_default = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) -_status_code_to_response = { - '200': _response_for_200, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _post_invalid_string_value_for_default_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_invalid_string_value_for_default_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_invalid_string_value_for_default_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_invalid_string_value_for_default_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_invalid_string_value_for_default_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_invalid_string_value_for_default.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostInvalidStringValueForDefaultRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_invalid_string_value_for_default_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_invalid_string_value_for_default_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_invalid_string_value_for_default_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_invalid_string_value_for_default_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_invalid_string_value_for_default_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_invalid_string_value_for_default_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_invalid_string_value_for_default_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_invalid_string_value_for_default_request_body/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_invalid_string_value_for_default_request_body/post.pyi deleted file mode 100644 index 00c9f71b026..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_invalid_string_value_for_default_request_body/post.pyi +++ /dev/null @@ -1,293 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.invalid_string_value_for_default import InvalidStringValueForDefault - -# body param -SchemaForRequestBodyApplicationJson = InvalidStringValueForDefault - - -request_body_invalid_string_value_for_default = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_invalid_string_value_for_default_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_invalid_string_value_for_default_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_invalid_string_value_for_default_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_invalid_string_value_for_default_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_invalid_string_value_for_default_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_invalid_string_value_for_default.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostInvalidStringValueForDefaultRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_invalid_string_value_for_default_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_invalid_string_value_for_default_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_invalid_string_value_for_default_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_invalid_string_value_for_default_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_invalid_string_value_for_default_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_invalid_string_value_for_default_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_invalid_string_value_for_default_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_invalid_string_value_for_default_request_body/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_invalid_string_value_for_default_request_body/post/__init__.py new file mode 100644 index 00000000000..ada20d4b8d1 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_invalid_string_value_for_default_request_body/post/__init__.py @@ -0,0 +1,291 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.invalid_string_value_for_default import InvalidStringValueForDefault + +from .. import path +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = InvalidStringValueForDefault + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + +_status_code_to_response = { + '200': response_for_200.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _post_invalid_string_value_for_default_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_invalid_string_value_for_default_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_invalid_string_value_for_default_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_invalid_string_value_for_default_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_invalid_string_value_for_default_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostInvalidStringValueForDefaultRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_invalid_string_value_for_default_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_invalid_string_value_for_default_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_invalid_string_value_for_default_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_invalid_string_value_for_default_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_invalid_string_value_for_default_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_invalid_string_value_for_default_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_invalid_string_value_for_default_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_invalid_string_value_for_default_request_body/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_invalid_string_value_for_default_request_body/post/__init__.pyi new file mode 100644 index 00000000000..f3a71721954 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_invalid_string_value_for_default_request_body/post/__init__.pyi @@ -0,0 +1,286 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.invalid_string_value_for_default import InvalidStringValueForDefault + +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = InvalidStringValueForDefault + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_invalid_string_value_for_default_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_invalid_string_value_for_default_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_invalid_string_value_for_default_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_invalid_string_value_for_default_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_invalid_string_value_for_default_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostInvalidStringValueForDefaultRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_invalid_string_value_for_default_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_invalid_string_value_for_default_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_invalid_string_value_for_default_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_invalid_string_value_for_default_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_invalid_string_value_for_default_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_invalid_string_value_for_default_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_invalid_string_value_for_default_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_invalid_string_value_for_default_request_body/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_invalid_string_value_for_default_request_body/post/response_for_200.py new file mode 100644 index 00000000000..ce057133be3 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_invalid_string_value_for_default_request_body/post/response_for_200.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ipv4_format_request_body/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ipv4_format_request_body/post.py deleted file mode 100644 index 9ffdb8d5be0..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ipv4_format_request_body/post.py +++ /dev/null @@ -1,318 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from . import path - -# body param - - -class SchemaForRequestBodyApplicationJson( - schemas.AnyTypeSchema, -): - - - class MetaOapg: - format = 'ipv4' - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'SchemaForRequestBodyApplicationJson': - return super().__new__( - cls, - *args, - _configuration=_configuration, - **kwargs, - ) - - -request_body_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) -_status_code_to_response = { - '200': _response_for_200, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _post_ipv4_format_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_ipv4_format_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_ipv4_format_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_ipv4_format_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_ipv4_format_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostIpv4FormatRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_ipv4_format_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_ipv4_format_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_ipv4_format_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_ipv4_format_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_ipv4_format_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_ipv4_format_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_ipv4_format_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ipv4_format_request_body/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ipv4_format_request_body/post.pyi deleted file mode 100644 index 21a1c8c5040..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ipv4_format_request_body/post.pyi +++ /dev/null @@ -1,313 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -# body param - - -class SchemaForRequestBodyApplicationJson( - schemas.AnyTypeSchema, -): - - - class MetaOapg: - format = 'ipv4' - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'SchemaForRequestBodyApplicationJson': - return super().__new__( - cls, - *args, - _configuration=_configuration, - **kwargs, - ) - - -request_body_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_ipv4_format_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_ipv4_format_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_ipv4_format_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_ipv4_format_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_ipv4_format_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostIpv4FormatRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_ipv4_format_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_ipv4_format_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_ipv4_format_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_ipv4_format_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_ipv4_format_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_ipv4_format_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_ipv4_format_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ipv4_format_request_body/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ipv4_format_request_body/post/__init__.py new file mode 100644 index 00000000000..14176c34de2 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ipv4_format_request_body/post/__init__.py @@ -0,0 +1,291 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.ipv4_format import Ipv4Format + +from .. import path +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = Ipv4Format + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + +_status_code_to_response = { + '200': response_for_200.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _post_ipv4_format_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_ipv4_format_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_ipv4_format_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_ipv4_format_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_ipv4_format_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostIpv4FormatRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_ipv4_format_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_ipv4_format_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_ipv4_format_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_ipv4_format_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_ipv4_format_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_ipv4_format_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_ipv4_format_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ipv4_format_request_body/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ipv4_format_request_body/post/__init__.pyi new file mode 100644 index 00000000000..8ba64e14106 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ipv4_format_request_body/post/__init__.pyi @@ -0,0 +1,286 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.ipv4_format import Ipv4Format + +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = Ipv4Format + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_ipv4_format_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_ipv4_format_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_ipv4_format_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_ipv4_format_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_ipv4_format_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostIpv4FormatRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_ipv4_format_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_ipv4_format_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_ipv4_format_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_ipv4_format_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_ipv4_format_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_ipv4_format_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_ipv4_format_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ipv4_format_request_body/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ipv4_format_request_body/post/response_for_200.py new file mode 100644 index 00000000000..ce057133be3 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ipv4_format_request_body/post/response_for_200.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ipv6_format_request_body/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ipv6_format_request_body/post.py deleted file mode 100644 index 8fb701cc61f..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ipv6_format_request_body/post.py +++ /dev/null @@ -1,318 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from . import path - -# body param - - -class SchemaForRequestBodyApplicationJson( - schemas.AnyTypeSchema, -): - - - class MetaOapg: - format = 'ipv6' - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'SchemaForRequestBodyApplicationJson': - return super().__new__( - cls, - *args, - _configuration=_configuration, - **kwargs, - ) - - -request_body_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) -_status_code_to_response = { - '200': _response_for_200, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _post_ipv6_format_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_ipv6_format_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_ipv6_format_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_ipv6_format_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_ipv6_format_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostIpv6FormatRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_ipv6_format_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_ipv6_format_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_ipv6_format_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_ipv6_format_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_ipv6_format_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_ipv6_format_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_ipv6_format_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ipv6_format_request_body/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ipv6_format_request_body/post.pyi deleted file mode 100644 index b50a09052e9..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ipv6_format_request_body/post.pyi +++ /dev/null @@ -1,313 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -# body param - - -class SchemaForRequestBodyApplicationJson( - schemas.AnyTypeSchema, -): - - - class MetaOapg: - format = 'ipv6' - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'SchemaForRequestBodyApplicationJson': - return super().__new__( - cls, - *args, - _configuration=_configuration, - **kwargs, - ) - - -request_body_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_ipv6_format_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_ipv6_format_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_ipv6_format_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_ipv6_format_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_ipv6_format_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostIpv6FormatRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_ipv6_format_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_ipv6_format_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_ipv6_format_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_ipv6_format_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_ipv6_format_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_ipv6_format_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_ipv6_format_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ipv6_format_request_body/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ipv6_format_request_body/post/__init__.py new file mode 100644 index 00000000000..e2500e7b2e3 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ipv6_format_request_body/post/__init__.py @@ -0,0 +1,291 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.ipv6_format import Ipv6Format + +from .. import path +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = Ipv6Format + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + +_status_code_to_response = { + '200': response_for_200.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _post_ipv6_format_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_ipv6_format_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_ipv6_format_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_ipv6_format_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_ipv6_format_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostIpv6FormatRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_ipv6_format_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_ipv6_format_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_ipv6_format_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_ipv6_format_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_ipv6_format_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_ipv6_format_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_ipv6_format_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ipv6_format_request_body/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ipv6_format_request_body/post/__init__.pyi new file mode 100644 index 00000000000..87f9d0d0fe4 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ipv6_format_request_body/post/__init__.pyi @@ -0,0 +1,286 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.ipv6_format import Ipv6Format + +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = Ipv6Format + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_ipv6_format_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_ipv6_format_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_ipv6_format_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_ipv6_format_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_ipv6_format_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostIpv6FormatRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_ipv6_format_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_ipv6_format_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_ipv6_format_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_ipv6_format_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_ipv6_format_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_ipv6_format_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_ipv6_format_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ipv6_format_request_body/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ipv6_format_request_body/post/response_for_200.py new file mode 100644 index 00000000000..ce057133be3 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ipv6_format_request_body/post/response_for_200.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_json_pointer_format_request_body/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_json_pointer_format_request_body/post.py deleted file mode 100644 index 1ad92bc8258..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_json_pointer_format_request_body/post.py +++ /dev/null @@ -1,318 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from . import path - -# body param - - -class SchemaForRequestBodyApplicationJson( - schemas.AnyTypeSchema, -): - - - class MetaOapg: - format = 'json-pointer' - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'SchemaForRequestBodyApplicationJson': - return super().__new__( - cls, - *args, - _configuration=_configuration, - **kwargs, - ) - - -request_body_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) -_status_code_to_response = { - '200': _response_for_200, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _post_json_pointer_format_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_json_pointer_format_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_json_pointer_format_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_json_pointer_format_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_json_pointer_format_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostJsonPointerFormatRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_json_pointer_format_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_json_pointer_format_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_json_pointer_format_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_json_pointer_format_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_json_pointer_format_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_json_pointer_format_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_json_pointer_format_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_json_pointer_format_request_body/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_json_pointer_format_request_body/post.pyi deleted file mode 100644 index 4e2d9ef6c59..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_json_pointer_format_request_body/post.pyi +++ /dev/null @@ -1,313 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -# body param - - -class SchemaForRequestBodyApplicationJson( - schemas.AnyTypeSchema, -): - - - class MetaOapg: - format = 'json-pointer' - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'SchemaForRequestBodyApplicationJson': - return super().__new__( - cls, - *args, - _configuration=_configuration, - **kwargs, - ) - - -request_body_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_json_pointer_format_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_json_pointer_format_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_json_pointer_format_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_json_pointer_format_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_json_pointer_format_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostJsonPointerFormatRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_json_pointer_format_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_json_pointer_format_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_json_pointer_format_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_json_pointer_format_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_json_pointer_format_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_json_pointer_format_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_json_pointer_format_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_json_pointer_format_request_body/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_json_pointer_format_request_body/post/__init__.py new file mode 100644 index 00000000000..1259e4a8367 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_json_pointer_format_request_body/post/__init__.py @@ -0,0 +1,291 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.json_pointer_format import JsonPointerFormat + +from .. import path +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = JsonPointerFormat + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + +_status_code_to_response = { + '200': response_for_200.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _post_json_pointer_format_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_json_pointer_format_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_json_pointer_format_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_json_pointer_format_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_json_pointer_format_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostJsonPointerFormatRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_json_pointer_format_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_json_pointer_format_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_json_pointer_format_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_json_pointer_format_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_json_pointer_format_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_json_pointer_format_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_json_pointer_format_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_json_pointer_format_request_body/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_json_pointer_format_request_body/post/__init__.pyi new file mode 100644 index 00000000000..7cf84230728 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_json_pointer_format_request_body/post/__init__.pyi @@ -0,0 +1,286 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.json_pointer_format import JsonPointerFormat + +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = JsonPointerFormat + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_json_pointer_format_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_json_pointer_format_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_json_pointer_format_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_json_pointer_format_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_json_pointer_format_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostJsonPointerFormatRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_json_pointer_format_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_json_pointer_format_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_json_pointer_format_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_json_pointer_format_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_json_pointer_format_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_json_pointer_format_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_json_pointer_format_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_json_pointer_format_request_body/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_json_pointer_format_request_body/post/response_for_200.py new file mode 100644 index 00000000000..ce057133be3 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_json_pointer_format_request_body/post/response_for_200.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_maximum_validation_request_body/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_maximum_validation_request_body/post.py deleted file mode 100644 index 982f83c735b..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_maximum_validation_request_body/post.py +++ /dev/null @@ -1,298 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.maximum_validation import MaximumValidation - -from . import path - -# body param -SchemaForRequestBodyApplicationJson = MaximumValidation - - -request_body_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) -_status_code_to_response = { - '200': _response_for_200, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _post_maximum_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_maximum_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_maximum_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_maximum_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_maximum_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostMaximumValidationRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_maximum_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_maximum_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_maximum_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_maximum_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_maximum_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_maximum_validation_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_maximum_validation_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_maximum_validation_request_body/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_maximum_validation_request_body/post.pyi deleted file mode 100644 index a0723cca701..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_maximum_validation_request_body/post.pyi +++ /dev/null @@ -1,293 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.maximum_validation import MaximumValidation - -# body param -SchemaForRequestBodyApplicationJson = MaximumValidation - - -request_body_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_maximum_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_maximum_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_maximum_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_maximum_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_maximum_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostMaximumValidationRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_maximum_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_maximum_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_maximum_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_maximum_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_maximum_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_maximum_validation_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_maximum_validation_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_maximum_validation_request_body/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_maximum_validation_request_body/post/__init__.py new file mode 100644 index 00000000000..a0771a1e7b6 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_maximum_validation_request_body/post/__init__.py @@ -0,0 +1,291 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.maximum_validation import MaximumValidation + +from .. import path +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = MaximumValidation + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + +_status_code_to_response = { + '200': response_for_200.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _post_maximum_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_maximum_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_maximum_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_maximum_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_maximum_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostMaximumValidationRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_maximum_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_maximum_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_maximum_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_maximum_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_maximum_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_maximum_validation_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_maximum_validation_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_maximum_validation_request_body/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_maximum_validation_request_body/post/__init__.pyi new file mode 100644 index 00000000000..ca9a3084940 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_maximum_validation_request_body/post/__init__.pyi @@ -0,0 +1,286 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.maximum_validation import MaximumValidation + +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = MaximumValidation + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_maximum_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_maximum_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_maximum_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_maximum_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_maximum_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostMaximumValidationRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_maximum_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_maximum_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_maximum_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_maximum_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_maximum_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_maximum_validation_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_maximum_validation_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_maximum_validation_request_body/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_maximum_validation_request_body/post/response_for_200.py new file mode 100644 index 00000000000..ce057133be3 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_maximum_validation_request_body/post/response_for_200.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_maximum_validation_with_unsigned_integer_request_body/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_maximum_validation_with_unsigned_integer_request_body/post.py deleted file mode 100644 index fcf0f9c4e2d..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_maximum_validation_with_unsigned_integer_request_body/post.py +++ /dev/null @@ -1,298 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.maximum_validation_with_unsigned_integer import MaximumValidationWithUnsignedInteger - -from . import path - -# body param -SchemaForRequestBodyApplicationJson = MaximumValidationWithUnsignedInteger - - -request_body_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) -_status_code_to_response = { - '200': _response_for_200, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _post_maximum_validation_with_unsigned_integer_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_maximum_validation_with_unsigned_integer_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_maximum_validation_with_unsigned_integer_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_maximum_validation_with_unsigned_integer_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_maximum_validation_with_unsigned_integer_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostMaximumValidationWithUnsignedIntegerRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_maximum_validation_with_unsigned_integer_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_maximum_validation_with_unsigned_integer_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_maximum_validation_with_unsigned_integer_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_maximum_validation_with_unsigned_integer_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_maximum_validation_with_unsigned_integer_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_maximum_validation_with_unsigned_integer_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_maximum_validation_with_unsigned_integer_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_maximum_validation_with_unsigned_integer_request_body/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_maximum_validation_with_unsigned_integer_request_body/post.pyi deleted file mode 100644 index 4e5c945af52..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_maximum_validation_with_unsigned_integer_request_body/post.pyi +++ /dev/null @@ -1,293 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.maximum_validation_with_unsigned_integer import MaximumValidationWithUnsignedInteger - -# body param -SchemaForRequestBodyApplicationJson = MaximumValidationWithUnsignedInteger - - -request_body_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_maximum_validation_with_unsigned_integer_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_maximum_validation_with_unsigned_integer_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_maximum_validation_with_unsigned_integer_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_maximum_validation_with_unsigned_integer_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_maximum_validation_with_unsigned_integer_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostMaximumValidationWithUnsignedIntegerRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_maximum_validation_with_unsigned_integer_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_maximum_validation_with_unsigned_integer_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_maximum_validation_with_unsigned_integer_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_maximum_validation_with_unsigned_integer_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_maximum_validation_with_unsigned_integer_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_maximum_validation_with_unsigned_integer_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_maximum_validation_with_unsigned_integer_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_maximum_validation_with_unsigned_integer_request_body/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_maximum_validation_with_unsigned_integer_request_body/post/__init__.py new file mode 100644 index 00000000000..0761ee85106 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_maximum_validation_with_unsigned_integer_request_body/post/__init__.py @@ -0,0 +1,291 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.maximum_validation_with_unsigned_integer import MaximumValidationWithUnsignedInteger + +from .. import path +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = MaximumValidationWithUnsignedInteger + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + +_status_code_to_response = { + '200': response_for_200.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _post_maximum_validation_with_unsigned_integer_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_maximum_validation_with_unsigned_integer_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_maximum_validation_with_unsigned_integer_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_maximum_validation_with_unsigned_integer_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_maximum_validation_with_unsigned_integer_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostMaximumValidationWithUnsignedIntegerRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_maximum_validation_with_unsigned_integer_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_maximum_validation_with_unsigned_integer_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_maximum_validation_with_unsigned_integer_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_maximum_validation_with_unsigned_integer_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_maximum_validation_with_unsigned_integer_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_maximum_validation_with_unsigned_integer_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_maximum_validation_with_unsigned_integer_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_maximum_validation_with_unsigned_integer_request_body/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_maximum_validation_with_unsigned_integer_request_body/post/__init__.pyi new file mode 100644 index 00000000000..88d90ba6ec0 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_maximum_validation_with_unsigned_integer_request_body/post/__init__.pyi @@ -0,0 +1,286 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.maximum_validation_with_unsigned_integer import MaximumValidationWithUnsignedInteger + +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = MaximumValidationWithUnsignedInteger + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_maximum_validation_with_unsigned_integer_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_maximum_validation_with_unsigned_integer_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_maximum_validation_with_unsigned_integer_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_maximum_validation_with_unsigned_integer_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_maximum_validation_with_unsigned_integer_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostMaximumValidationWithUnsignedIntegerRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_maximum_validation_with_unsigned_integer_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_maximum_validation_with_unsigned_integer_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_maximum_validation_with_unsigned_integer_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_maximum_validation_with_unsigned_integer_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_maximum_validation_with_unsigned_integer_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_maximum_validation_with_unsigned_integer_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_maximum_validation_with_unsigned_integer_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_maximum_validation_with_unsigned_integer_request_body/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_maximum_validation_with_unsigned_integer_request_body/post/response_for_200.py new file mode 100644 index 00000000000..ce057133be3 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_maximum_validation_with_unsigned_integer_request_body/post/response_for_200.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_maxitems_validation_request_body/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_maxitems_validation_request_body/post.py deleted file mode 100644 index 08f984ff02d..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_maxitems_validation_request_body/post.py +++ /dev/null @@ -1,298 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.maxitems_validation import MaxitemsValidation - -from . import path - -# body param -SchemaForRequestBodyApplicationJson = MaxitemsValidation - - -request_body_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) -_status_code_to_response = { - '200': _response_for_200, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _post_maxitems_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_maxitems_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_maxitems_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_maxitems_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_maxitems_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostMaxitemsValidationRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_maxitems_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_maxitems_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_maxitems_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_maxitems_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_maxitems_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_maxitems_validation_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_maxitems_validation_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_maxitems_validation_request_body/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_maxitems_validation_request_body/post.pyi deleted file mode 100644 index a42d2f09c2f..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_maxitems_validation_request_body/post.pyi +++ /dev/null @@ -1,293 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.maxitems_validation import MaxitemsValidation - -# body param -SchemaForRequestBodyApplicationJson = MaxitemsValidation - - -request_body_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_maxitems_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_maxitems_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_maxitems_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_maxitems_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_maxitems_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostMaxitemsValidationRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_maxitems_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_maxitems_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_maxitems_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_maxitems_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_maxitems_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_maxitems_validation_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_maxitems_validation_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_maxitems_validation_request_body/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_maxitems_validation_request_body/post/__init__.py new file mode 100644 index 00000000000..e58df3a1f68 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_maxitems_validation_request_body/post/__init__.py @@ -0,0 +1,291 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.maxitems_validation import MaxitemsValidation + +from .. import path +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = MaxitemsValidation + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + +_status_code_to_response = { + '200': response_for_200.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _post_maxitems_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_maxitems_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_maxitems_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_maxitems_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_maxitems_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostMaxitemsValidationRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_maxitems_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_maxitems_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_maxitems_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_maxitems_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_maxitems_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_maxitems_validation_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_maxitems_validation_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_maxitems_validation_request_body/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_maxitems_validation_request_body/post/__init__.pyi new file mode 100644 index 00000000000..9276ebbbc85 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_maxitems_validation_request_body/post/__init__.pyi @@ -0,0 +1,286 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.maxitems_validation import MaxitemsValidation + +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = MaxitemsValidation + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_maxitems_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_maxitems_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_maxitems_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_maxitems_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_maxitems_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostMaxitemsValidationRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_maxitems_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_maxitems_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_maxitems_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_maxitems_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_maxitems_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_maxitems_validation_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_maxitems_validation_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_maxitems_validation_request_body/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_maxitems_validation_request_body/post/response_for_200.py new file mode 100644 index 00000000000..ce057133be3 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_maxitems_validation_request_body/post/response_for_200.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_maxlength_validation_request_body/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_maxlength_validation_request_body/post.py deleted file mode 100644 index d9f0c7ca462..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_maxlength_validation_request_body/post.py +++ /dev/null @@ -1,298 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.maxlength_validation import MaxlengthValidation - -from . import path - -# body param -SchemaForRequestBodyApplicationJson = MaxlengthValidation - - -request_body_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) -_status_code_to_response = { - '200': _response_for_200, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _post_maxlength_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_maxlength_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_maxlength_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_maxlength_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_maxlength_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostMaxlengthValidationRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_maxlength_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_maxlength_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_maxlength_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_maxlength_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_maxlength_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_maxlength_validation_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_maxlength_validation_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_maxlength_validation_request_body/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_maxlength_validation_request_body/post.pyi deleted file mode 100644 index b2e42052a3a..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_maxlength_validation_request_body/post.pyi +++ /dev/null @@ -1,293 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.maxlength_validation import MaxlengthValidation - -# body param -SchemaForRequestBodyApplicationJson = MaxlengthValidation - - -request_body_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_maxlength_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_maxlength_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_maxlength_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_maxlength_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_maxlength_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostMaxlengthValidationRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_maxlength_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_maxlength_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_maxlength_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_maxlength_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_maxlength_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_maxlength_validation_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_maxlength_validation_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_maxlength_validation_request_body/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_maxlength_validation_request_body/post/__init__.py new file mode 100644 index 00000000000..121d858a204 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_maxlength_validation_request_body/post/__init__.py @@ -0,0 +1,291 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.maxlength_validation import MaxlengthValidation + +from .. import path +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = MaxlengthValidation + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + +_status_code_to_response = { + '200': response_for_200.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _post_maxlength_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_maxlength_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_maxlength_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_maxlength_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_maxlength_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostMaxlengthValidationRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_maxlength_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_maxlength_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_maxlength_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_maxlength_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_maxlength_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_maxlength_validation_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_maxlength_validation_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_maxlength_validation_request_body/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_maxlength_validation_request_body/post/__init__.pyi new file mode 100644 index 00000000000..92a7b987edc --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_maxlength_validation_request_body/post/__init__.pyi @@ -0,0 +1,286 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.maxlength_validation import MaxlengthValidation + +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = MaxlengthValidation + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_maxlength_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_maxlength_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_maxlength_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_maxlength_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_maxlength_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostMaxlengthValidationRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_maxlength_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_maxlength_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_maxlength_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_maxlength_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_maxlength_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_maxlength_validation_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_maxlength_validation_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_maxlength_validation_request_body/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_maxlength_validation_request_body/post/response_for_200.py new file mode 100644 index 00000000000..ce057133be3 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_maxlength_validation_request_body/post/response_for_200.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_maxproperties0_means_the_object_is_empty_request_body/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_maxproperties0_means_the_object_is_empty_request_body/post.py deleted file mode 100644 index 8df9e45dde1..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_maxproperties0_means_the_object_is_empty_request_body/post.py +++ /dev/null @@ -1,298 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.maxproperties0_means_the_object_is_empty import Maxproperties0MeansTheObjectIsEmpty - -from . import path - -# body param -SchemaForRequestBodyApplicationJson = Maxproperties0MeansTheObjectIsEmpty - - -request_body_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) -_status_code_to_response = { - '200': _response_for_200, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _post_maxproperties0_means_the_object_is_empty_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_maxproperties0_means_the_object_is_empty_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_maxproperties0_means_the_object_is_empty_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_maxproperties0_means_the_object_is_empty_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_maxproperties0_means_the_object_is_empty_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostMaxproperties0MeansTheObjectIsEmptyRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_maxproperties0_means_the_object_is_empty_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_maxproperties0_means_the_object_is_empty_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_maxproperties0_means_the_object_is_empty_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_maxproperties0_means_the_object_is_empty_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_maxproperties0_means_the_object_is_empty_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_maxproperties0_means_the_object_is_empty_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_maxproperties0_means_the_object_is_empty_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_maxproperties0_means_the_object_is_empty_request_body/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_maxproperties0_means_the_object_is_empty_request_body/post.pyi deleted file mode 100644 index 544af50745a..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_maxproperties0_means_the_object_is_empty_request_body/post.pyi +++ /dev/null @@ -1,293 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.maxproperties0_means_the_object_is_empty import Maxproperties0MeansTheObjectIsEmpty - -# body param -SchemaForRequestBodyApplicationJson = Maxproperties0MeansTheObjectIsEmpty - - -request_body_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_maxproperties0_means_the_object_is_empty_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_maxproperties0_means_the_object_is_empty_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_maxproperties0_means_the_object_is_empty_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_maxproperties0_means_the_object_is_empty_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_maxproperties0_means_the_object_is_empty_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostMaxproperties0MeansTheObjectIsEmptyRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_maxproperties0_means_the_object_is_empty_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_maxproperties0_means_the_object_is_empty_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_maxproperties0_means_the_object_is_empty_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_maxproperties0_means_the_object_is_empty_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_maxproperties0_means_the_object_is_empty_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_maxproperties0_means_the_object_is_empty_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_maxproperties0_means_the_object_is_empty_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_maxproperties0_means_the_object_is_empty_request_body/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_maxproperties0_means_the_object_is_empty_request_body/post/__init__.py new file mode 100644 index 00000000000..8f24c308fd8 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_maxproperties0_means_the_object_is_empty_request_body/post/__init__.py @@ -0,0 +1,291 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.maxproperties0_means_the_object_is_empty import Maxproperties0MeansTheObjectIsEmpty + +from .. import path +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = Maxproperties0MeansTheObjectIsEmpty + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + +_status_code_to_response = { + '200': response_for_200.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _post_maxproperties0_means_the_object_is_empty_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_maxproperties0_means_the_object_is_empty_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_maxproperties0_means_the_object_is_empty_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_maxproperties0_means_the_object_is_empty_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_maxproperties0_means_the_object_is_empty_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostMaxproperties0MeansTheObjectIsEmptyRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_maxproperties0_means_the_object_is_empty_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_maxproperties0_means_the_object_is_empty_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_maxproperties0_means_the_object_is_empty_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_maxproperties0_means_the_object_is_empty_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_maxproperties0_means_the_object_is_empty_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_maxproperties0_means_the_object_is_empty_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_maxproperties0_means_the_object_is_empty_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_maxproperties0_means_the_object_is_empty_request_body/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_maxproperties0_means_the_object_is_empty_request_body/post/__init__.pyi new file mode 100644 index 00000000000..a9f10243804 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_maxproperties0_means_the_object_is_empty_request_body/post/__init__.pyi @@ -0,0 +1,286 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.maxproperties0_means_the_object_is_empty import Maxproperties0MeansTheObjectIsEmpty + +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = Maxproperties0MeansTheObjectIsEmpty + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_maxproperties0_means_the_object_is_empty_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_maxproperties0_means_the_object_is_empty_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_maxproperties0_means_the_object_is_empty_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_maxproperties0_means_the_object_is_empty_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_maxproperties0_means_the_object_is_empty_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostMaxproperties0MeansTheObjectIsEmptyRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_maxproperties0_means_the_object_is_empty_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_maxproperties0_means_the_object_is_empty_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_maxproperties0_means_the_object_is_empty_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_maxproperties0_means_the_object_is_empty_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_maxproperties0_means_the_object_is_empty_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_maxproperties0_means_the_object_is_empty_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_maxproperties0_means_the_object_is_empty_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_maxproperties0_means_the_object_is_empty_request_body/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_maxproperties0_means_the_object_is_empty_request_body/post/response_for_200.py new file mode 100644 index 00000000000..ce057133be3 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_maxproperties0_means_the_object_is_empty_request_body/post/response_for_200.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_maxproperties_validation_request_body/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_maxproperties_validation_request_body/post.py deleted file mode 100644 index 67fd2d8ab4d..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_maxproperties_validation_request_body/post.py +++ /dev/null @@ -1,298 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.maxproperties_validation import MaxpropertiesValidation - -from . import path - -# body param -SchemaForRequestBodyApplicationJson = MaxpropertiesValidation - - -request_body_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) -_status_code_to_response = { - '200': _response_for_200, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _post_maxproperties_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_maxproperties_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_maxproperties_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_maxproperties_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_maxproperties_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostMaxpropertiesValidationRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_maxproperties_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_maxproperties_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_maxproperties_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_maxproperties_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_maxproperties_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_maxproperties_validation_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_maxproperties_validation_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_maxproperties_validation_request_body/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_maxproperties_validation_request_body/post.pyi deleted file mode 100644 index 5119d69b5ed..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_maxproperties_validation_request_body/post.pyi +++ /dev/null @@ -1,293 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.maxproperties_validation import MaxpropertiesValidation - -# body param -SchemaForRequestBodyApplicationJson = MaxpropertiesValidation - - -request_body_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_maxproperties_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_maxproperties_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_maxproperties_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_maxproperties_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_maxproperties_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostMaxpropertiesValidationRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_maxproperties_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_maxproperties_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_maxproperties_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_maxproperties_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_maxproperties_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_maxproperties_validation_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_maxproperties_validation_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_maxproperties_validation_request_body/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_maxproperties_validation_request_body/post/__init__.py new file mode 100644 index 00000000000..cd0c1f72fe0 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_maxproperties_validation_request_body/post/__init__.py @@ -0,0 +1,291 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.maxproperties_validation import MaxpropertiesValidation + +from .. import path +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = MaxpropertiesValidation + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + +_status_code_to_response = { + '200': response_for_200.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _post_maxproperties_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_maxproperties_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_maxproperties_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_maxproperties_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_maxproperties_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostMaxpropertiesValidationRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_maxproperties_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_maxproperties_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_maxproperties_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_maxproperties_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_maxproperties_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_maxproperties_validation_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_maxproperties_validation_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_maxproperties_validation_request_body/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_maxproperties_validation_request_body/post/__init__.pyi new file mode 100644 index 00000000000..5f31216b4c3 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_maxproperties_validation_request_body/post/__init__.pyi @@ -0,0 +1,286 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.maxproperties_validation import MaxpropertiesValidation + +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = MaxpropertiesValidation + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_maxproperties_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_maxproperties_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_maxproperties_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_maxproperties_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_maxproperties_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostMaxpropertiesValidationRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_maxproperties_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_maxproperties_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_maxproperties_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_maxproperties_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_maxproperties_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_maxproperties_validation_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_maxproperties_validation_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_maxproperties_validation_request_body/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_maxproperties_validation_request_body/post/response_for_200.py new file mode 100644 index 00000000000..ce057133be3 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_maxproperties_validation_request_body/post/response_for_200.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_minimum_validation_request_body/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_minimum_validation_request_body/post.py deleted file mode 100644 index b1e1c0d2275..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_minimum_validation_request_body/post.py +++ /dev/null @@ -1,298 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.minimum_validation import MinimumValidation - -from . import path - -# body param -SchemaForRequestBodyApplicationJson = MinimumValidation - - -request_body_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) -_status_code_to_response = { - '200': _response_for_200, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _post_minimum_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_minimum_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_minimum_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_minimum_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_minimum_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostMinimumValidationRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_minimum_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_minimum_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_minimum_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_minimum_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_minimum_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_minimum_validation_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_minimum_validation_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_minimum_validation_request_body/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_minimum_validation_request_body/post.pyi deleted file mode 100644 index 0e7fa1996fa..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_minimum_validation_request_body/post.pyi +++ /dev/null @@ -1,293 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.minimum_validation import MinimumValidation - -# body param -SchemaForRequestBodyApplicationJson = MinimumValidation - - -request_body_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_minimum_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_minimum_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_minimum_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_minimum_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_minimum_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostMinimumValidationRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_minimum_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_minimum_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_minimum_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_minimum_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_minimum_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_minimum_validation_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_minimum_validation_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_minimum_validation_request_body/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_minimum_validation_request_body/post/__init__.py new file mode 100644 index 00000000000..bfef05be67d --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_minimum_validation_request_body/post/__init__.py @@ -0,0 +1,291 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.minimum_validation import MinimumValidation + +from .. import path +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = MinimumValidation + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + +_status_code_to_response = { + '200': response_for_200.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _post_minimum_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_minimum_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_minimum_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_minimum_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_minimum_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostMinimumValidationRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_minimum_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_minimum_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_minimum_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_minimum_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_minimum_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_minimum_validation_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_minimum_validation_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_minimum_validation_request_body/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_minimum_validation_request_body/post/__init__.pyi new file mode 100644 index 00000000000..6e0a8d1b0f2 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_minimum_validation_request_body/post/__init__.pyi @@ -0,0 +1,286 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.minimum_validation import MinimumValidation + +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = MinimumValidation + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_minimum_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_minimum_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_minimum_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_minimum_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_minimum_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostMinimumValidationRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_minimum_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_minimum_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_minimum_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_minimum_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_minimum_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_minimum_validation_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_minimum_validation_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_minimum_validation_request_body/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_minimum_validation_request_body/post/response_for_200.py new file mode 100644 index 00000000000..ce057133be3 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_minimum_validation_request_body/post/response_for_200.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_minimum_validation_with_signed_integer_request_body/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_minimum_validation_with_signed_integer_request_body/post.py deleted file mode 100644 index 78129065be1..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_minimum_validation_with_signed_integer_request_body/post.py +++ /dev/null @@ -1,298 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.minimum_validation_with_signed_integer import MinimumValidationWithSignedInteger - -from . import path - -# body param -SchemaForRequestBodyApplicationJson = MinimumValidationWithSignedInteger - - -request_body_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) -_status_code_to_response = { - '200': _response_for_200, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _post_minimum_validation_with_signed_integer_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_minimum_validation_with_signed_integer_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_minimum_validation_with_signed_integer_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_minimum_validation_with_signed_integer_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_minimum_validation_with_signed_integer_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostMinimumValidationWithSignedIntegerRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_minimum_validation_with_signed_integer_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_minimum_validation_with_signed_integer_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_minimum_validation_with_signed_integer_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_minimum_validation_with_signed_integer_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_minimum_validation_with_signed_integer_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_minimum_validation_with_signed_integer_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_minimum_validation_with_signed_integer_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_minimum_validation_with_signed_integer_request_body/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_minimum_validation_with_signed_integer_request_body/post.pyi deleted file mode 100644 index c8539721b25..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_minimum_validation_with_signed_integer_request_body/post.pyi +++ /dev/null @@ -1,293 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.minimum_validation_with_signed_integer import MinimumValidationWithSignedInteger - -# body param -SchemaForRequestBodyApplicationJson = MinimumValidationWithSignedInteger - - -request_body_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_minimum_validation_with_signed_integer_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_minimum_validation_with_signed_integer_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_minimum_validation_with_signed_integer_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_minimum_validation_with_signed_integer_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_minimum_validation_with_signed_integer_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostMinimumValidationWithSignedIntegerRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_minimum_validation_with_signed_integer_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_minimum_validation_with_signed_integer_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_minimum_validation_with_signed_integer_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_minimum_validation_with_signed_integer_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_minimum_validation_with_signed_integer_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_minimum_validation_with_signed_integer_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_minimum_validation_with_signed_integer_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_minimum_validation_with_signed_integer_request_body/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_minimum_validation_with_signed_integer_request_body/post/__init__.py new file mode 100644 index 00000000000..c4902e8de6e --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_minimum_validation_with_signed_integer_request_body/post/__init__.py @@ -0,0 +1,291 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.minimum_validation_with_signed_integer import MinimumValidationWithSignedInteger + +from .. import path +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = MinimumValidationWithSignedInteger + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + +_status_code_to_response = { + '200': response_for_200.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _post_minimum_validation_with_signed_integer_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_minimum_validation_with_signed_integer_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_minimum_validation_with_signed_integer_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_minimum_validation_with_signed_integer_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_minimum_validation_with_signed_integer_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostMinimumValidationWithSignedIntegerRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_minimum_validation_with_signed_integer_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_minimum_validation_with_signed_integer_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_minimum_validation_with_signed_integer_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_minimum_validation_with_signed_integer_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_minimum_validation_with_signed_integer_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_minimum_validation_with_signed_integer_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_minimum_validation_with_signed_integer_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_minimum_validation_with_signed_integer_request_body/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_minimum_validation_with_signed_integer_request_body/post/__init__.pyi new file mode 100644 index 00000000000..d7aa1a91082 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_minimum_validation_with_signed_integer_request_body/post/__init__.pyi @@ -0,0 +1,286 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.minimum_validation_with_signed_integer import MinimumValidationWithSignedInteger + +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = MinimumValidationWithSignedInteger + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_minimum_validation_with_signed_integer_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_minimum_validation_with_signed_integer_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_minimum_validation_with_signed_integer_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_minimum_validation_with_signed_integer_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_minimum_validation_with_signed_integer_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostMinimumValidationWithSignedIntegerRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_minimum_validation_with_signed_integer_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_minimum_validation_with_signed_integer_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_minimum_validation_with_signed_integer_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_minimum_validation_with_signed_integer_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_minimum_validation_with_signed_integer_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_minimum_validation_with_signed_integer_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_minimum_validation_with_signed_integer_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_minimum_validation_with_signed_integer_request_body/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_minimum_validation_with_signed_integer_request_body/post/response_for_200.py new file mode 100644 index 00000000000..ce057133be3 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_minimum_validation_with_signed_integer_request_body/post/response_for_200.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_minitems_validation_request_body/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_minitems_validation_request_body/post.py deleted file mode 100644 index e6282c3f44e..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_minitems_validation_request_body/post.py +++ /dev/null @@ -1,298 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.minitems_validation import MinitemsValidation - -from . import path - -# body param -SchemaForRequestBodyApplicationJson = MinitemsValidation - - -request_body_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) -_status_code_to_response = { - '200': _response_for_200, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _post_minitems_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_minitems_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_minitems_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_minitems_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_minitems_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostMinitemsValidationRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_minitems_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_minitems_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_minitems_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_minitems_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_minitems_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_minitems_validation_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_minitems_validation_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_minitems_validation_request_body/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_minitems_validation_request_body/post.pyi deleted file mode 100644 index d755c0d7557..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_minitems_validation_request_body/post.pyi +++ /dev/null @@ -1,293 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.minitems_validation import MinitemsValidation - -# body param -SchemaForRequestBodyApplicationJson = MinitemsValidation - - -request_body_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_minitems_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_minitems_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_minitems_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_minitems_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_minitems_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostMinitemsValidationRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_minitems_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_minitems_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_minitems_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_minitems_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_minitems_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_minitems_validation_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_minitems_validation_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_minitems_validation_request_body/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_minitems_validation_request_body/post/__init__.py new file mode 100644 index 00000000000..6e56ccc1308 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_minitems_validation_request_body/post/__init__.py @@ -0,0 +1,291 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.minitems_validation import MinitemsValidation + +from .. import path +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = MinitemsValidation + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + +_status_code_to_response = { + '200': response_for_200.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _post_minitems_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_minitems_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_minitems_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_minitems_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_minitems_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostMinitemsValidationRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_minitems_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_minitems_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_minitems_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_minitems_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_minitems_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_minitems_validation_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_minitems_validation_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_minitems_validation_request_body/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_minitems_validation_request_body/post/__init__.pyi new file mode 100644 index 00000000000..403998c0f80 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_minitems_validation_request_body/post/__init__.pyi @@ -0,0 +1,286 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.minitems_validation import MinitemsValidation + +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = MinitemsValidation + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_minitems_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_minitems_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_minitems_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_minitems_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_minitems_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostMinitemsValidationRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_minitems_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_minitems_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_minitems_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_minitems_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_minitems_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_minitems_validation_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_minitems_validation_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_minitems_validation_request_body/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_minitems_validation_request_body/post/response_for_200.py new file mode 100644 index 00000000000..ce057133be3 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_minitems_validation_request_body/post/response_for_200.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_minlength_validation_request_body/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_minlength_validation_request_body/post.py deleted file mode 100644 index 192b4f1d158..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_minlength_validation_request_body/post.py +++ /dev/null @@ -1,298 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.minlength_validation import MinlengthValidation - -from . import path - -# body param -SchemaForRequestBodyApplicationJson = MinlengthValidation - - -request_body_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) -_status_code_to_response = { - '200': _response_for_200, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _post_minlength_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_minlength_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_minlength_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_minlength_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_minlength_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostMinlengthValidationRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_minlength_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_minlength_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_minlength_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_minlength_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_minlength_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_minlength_validation_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_minlength_validation_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_minlength_validation_request_body/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_minlength_validation_request_body/post.pyi deleted file mode 100644 index 7436c84bb26..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_minlength_validation_request_body/post.pyi +++ /dev/null @@ -1,293 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.minlength_validation import MinlengthValidation - -# body param -SchemaForRequestBodyApplicationJson = MinlengthValidation - - -request_body_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_minlength_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_minlength_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_minlength_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_minlength_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_minlength_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostMinlengthValidationRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_minlength_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_minlength_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_minlength_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_minlength_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_minlength_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_minlength_validation_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_minlength_validation_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_minlength_validation_request_body/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_minlength_validation_request_body/post/__init__.py new file mode 100644 index 00000000000..f863d1535a9 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_minlength_validation_request_body/post/__init__.py @@ -0,0 +1,291 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.minlength_validation import MinlengthValidation + +from .. import path +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = MinlengthValidation + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + +_status_code_to_response = { + '200': response_for_200.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _post_minlength_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_minlength_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_minlength_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_minlength_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_minlength_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostMinlengthValidationRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_minlength_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_minlength_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_minlength_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_minlength_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_minlength_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_minlength_validation_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_minlength_validation_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_minlength_validation_request_body/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_minlength_validation_request_body/post/__init__.pyi new file mode 100644 index 00000000000..02bc19ee81a --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_minlength_validation_request_body/post/__init__.pyi @@ -0,0 +1,286 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.minlength_validation import MinlengthValidation + +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = MinlengthValidation + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_minlength_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_minlength_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_minlength_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_minlength_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_minlength_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostMinlengthValidationRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_minlength_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_minlength_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_minlength_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_minlength_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_minlength_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_minlength_validation_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_minlength_validation_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_minlength_validation_request_body/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_minlength_validation_request_body/post/response_for_200.py new file mode 100644 index 00000000000..ce057133be3 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_minlength_validation_request_body/post/response_for_200.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_minproperties_validation_request_body/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_minproperties_validation_request_body/post.py deleted file mode 100644 index e6162712122..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_minproperties_validation_request_body/post.py +++ /dev/null @@ -1,298 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.minproperties_validation import MinpropertiesValidation - -from . import path - -# body param -SchemaForRequestBodyApplicationJson = MinpropertiesValidation - - -request_body_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) -_status_code_to_response = { - '200': _response_for_200, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _post_minproperties_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_minproperties_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_minproperties_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_minproperties_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_minproperties_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostMinpropertiesValidationRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_minproperties_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_minproperties_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_minproperties_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_minproperties_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_minproperties_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_minproperties_validation_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_minproperties_validation_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_minproperties_validation_request_body/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_minproperties_validation_request_body/post.pyi deleted file mode 100644 index 2d4602b4aaf..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_minproperties_validation_request_body/post.pyi +++ /dev/null @@ -1,293 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.minproperties_validation import MinpropertiesValidation - -# body param -SchemaForRequestBodyApplicationJson = MinpropertiesValidation - - -request_body_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_minproperties_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_minproperties_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_minproperties_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_minproperties_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_minproperties_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostMinpropertiesValidationRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_minproperties_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_minproperties_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_minproperties_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_minproperties_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_minproperties_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_minproperties_validation_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_minproperties_validation_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_minproperties_validation_request_body/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_minproperties_validation_request_body/post/__init__.py new file mode 100644 index 00000000000..81c5ccd640c --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_minproperties_validation_request_body/post/__init__.py @@ -0,0 +1,291 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.minproperties_validation import MinpropertiesValidation + +from .. import path +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = MinpropertiesValidation + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + +_status_code_to_response = { + '200': response_for_200.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _post_minproperties_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_minproperties_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_minproperties_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_minproperties_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_minproperties_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostMinpropertiesValidationRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_minproperties_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_minproperties_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_minproperties_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_minproperties_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_minproperties_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_minproperties_validation_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_minproperties_validation_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_minproperties_validation_request_body/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_minproperties_validation_request_body/post/__init__.pyi new file mode 100644 index 00000000000..02d829808d4 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_minproperties_validation_request_body/post/__init__.pyi @@ -0,0 +1,286 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.minproperties_validation import MinpropertiesValidation + +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = MinpropertiesValidation + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_minproperties_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_minproperties_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_minproperties_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_minproperties_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_minproperties_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostMinpropertiesValidationRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_minproperties_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_minproperties_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_minproperties_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_minproperties_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_minproperties_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_minproperties_validation_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_minproperties_validation_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_minproperties_validation_request_body/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_minproperties_validation_request_body/post/response_for_200.py new file mode 100644 index 00000000000..ce057133be3 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_minproperties_validation_request_body/post/response_for_200.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_nested_allof_to_check_validation_semantics_request_body/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_nested_allof_to_check_validation_semantics_request_body/post.py deleted file mode 100644 index 04886b3f9f7..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_nested_allof_to_check_validation_semantics_request_body/post.py +++ /dev/null @@ -1,298 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.nested_allof_to_check_validation_semantics import NestedAllofToCheckValidationSemantics - -from . import path - -# body param -SchemaForRequestBodyApplicationJson = NestedAllofToCheckValidationSemantics - - -request_body_nested_allof_to_check_validation_semantics = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) -_status_code_to_response = { - '200': _response_for_200, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _post_nested_allof_to_check_validation_semantics_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_nested_allof_to_check_validation_semantics_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_nested_allof_to_check_validation_semantics_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_nested_allof_to_check_validation_semantics_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_nested_allof_to_check_validation_semantics_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_nested_allof_to_check_validation_semantics.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostNestedAllofToCheckValidationSemanticsRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_nested_allof_to_check_validation_semantics_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_nested_allof_to_check_validation_semantics_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_nested_allof_to_check_validation_semantics_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_nested_allof_to_check_validation_semantics_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_nested_allof_to_check_validation_semantics_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_nested_allof_to_check_validation_semantics_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_nested_allof_to_check_validation_semantics_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_nested_allof_to_check_validation_semantics_request_body/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_nested_allof_to_check_validation_semantics_request_body/post.pyi deleted file mode 100644 index ba2e00fa218..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_nested_allof_to_check_validation_semantics_request_body/post.pyi +++ /dev/null @@ -1,293 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.nested_allof_to_check_validation_semantics import NestedAllofToCheckValidationSemantics - -# body param -SchemaForRequestBodyApplicationJson = NestedAllofToCheckValidationSemantics - - -request_body_nested_allof_to_check_validation_semantics = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_nested_allof_to_check_validation_semantics_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_nested_allof_to_check_validation_semantics_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_nested_allof_to_check_validation_semantics_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_nested_allof_to_check_validation_semantics_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_nested_allof_to_check_validation_semantics_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_nested_allof_to_check_validation_semantics.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostNestedAllofToCheckValidationSemanticsRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_nested_allof_to_check_validation_semantics_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_nested_allof_to_check_validation_semantics_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_nested_allof_to_check_validation_semantics_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_nested_allof_to_check_validation_semantics_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_nested_allof_to_check_validation_semantics_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_nested_allof_to_check_validation_semantics_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_nested_allof_to_check_validation_semantics_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_nested_allof_to_check_validation_semantics_request_body/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_nested_allof_to_check_validation_semantics_request_body/post/__init__.py new file mode 100644 index 00000000000..17ac007003f --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_nested_allof_to_check_validation_semantics_request_body/post/__init__.py @@ -0,0 +1,291 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.nested_allof_to_check_validation_semantics import NestedAllofToCheckValidationSemantics + +from .. import path +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = NestedAllofToCheckValidationSemantics + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + +_status_code_to_response = { + '200': response_for_200.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _post_nested_allof_to_check_validation_semantics_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_nested_allof_to_check_validation_semantics_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_nested_allof_to_check_validation_semantics_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_nested_allof_to_check_validation_semantics_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_nested_allof_to_check_validation_semantics_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostNestedAllofToCheckValidationSemanticsRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_nested_allof_to_check_validation_semantics_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_nested_allof_to_check_validation_semantics_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_nested_allof_to_check_validation_semantics_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_nested_allof_to_check_validation_semantics_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_nested_allof_to_check_validation_semantics_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_nested_allof_to_check_validation_semantics_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_nested_allof_to_check_validation_semantics_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_nested_allof_to_check_validation_semantics_request_body/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_nested_allof_to_check_validation_semantics_request_body/post/__init__.pyi new file mode 100644 index 00000000000..c66ab6cd23c --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_nested_allof_to_check_validation_semantics_request_body/post/__init__.pyi @@ -0,0 +1,286 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.nested_allof_to_check_validation_semantics import NestedAllofToCheckValidationSemantics + +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = NestedAllofToCheckValidationSemantics + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_nested_allof_to_check_validation_semantics_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_nested_allof_to_check_validation_semantics_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_nested_allof_to_check_validation_semantics_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_nested_allof_to_check_validation_semantics_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_nested_allof_to_check_validation_semantics_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostNestedAllofToCheckValidationSemanticsRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_nested_allof_to_check_validation_semantics_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_nested_allof_to_check_validation_semantics_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_nested_allof_to_check_validation_semantics_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_nested_allof_to_check_validation_semantics_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_nested_allof_to_check_validation_semantics_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_nested_allof_to_check_validation_semantics_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_nested_allof_to_check_validation_semantics_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_nested_allof_to_check_validation_semantics_request_body/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_nested_allof_to_check_validation_semantics_request_body/post/response_for_200.py new file mode 100644 index 00000000000..ce057133be3 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_nested_allof_to_check_validation_semantics_request_body/post/response_for_200.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_nested_anyof_to_check_validation_semantics_request_body/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_nested_anyof_to_check_validation_semantics_request_body/post.py deleted file mode 100644 index ddfa4e71d84..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_nested_anyof_to_check_validation_semantics_request_body/post.py +++ /dev/null @@ -1,298 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.nested_anyof_to_check_validation_semantics import NestedAnyofToCheckValidationSemantics - -from . import path - -# body param -SchemaForRequestBodyApplicationJson = NestedAnyofToCheckValidationSemantics - - -request_body_nested_anyof_to_check_validation_semantics = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) -_status_code_to_response = { - '200': _response_for_200, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _post_nested_anyof_to_check_validation_semantics_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_nested_anyof_to_check_validation_semantics_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_nested_anyof_to_check_validation_semantics_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_nested_anyof_to_check_validation_semantics_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_nested_anyof_to_check_validation_semantics_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_nested_anyof_to_check_validation_semantics.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostNestedAnyofToCheckValidationSemanticsRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_nested_anyof_to_check_validation_semantics_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_nested_anyof_to_check_validation_semantics_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_nested_anyof_to_check_validation_semantics_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_nested_anyof_to_check_validation_semantics_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_nested_anyof_to_check_validation_semantics_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_nested_anyof_to_check_validation_semantics_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_nested_anyof_to_check_validation_semantics_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_nested_anyof_to_check_validation_semantics_request_body/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_nested_anyof_to_check_validation_semantics_request_body/post.pyi deleted file mode 100644 index b660117c48b..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_nested_anyof_to_check_validation_semantics_request_body/post.pyi +++ /dev/null @@ -1,293 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.nested_anyof_to_check_validation_semantics import NestedAnyofToCheckValidationSemantics - -# body param -SchemaForRequestBodyApplicationJson = NestedAnyofToCheckValidationSemantics - - -request_body_nested_anyof_to_check_validation_semantics = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_nested_anyof_to_check_validation_semantics_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_nested_anyof_to_check_validation_semantics_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_nested_anyof_to_check_validation_semantics_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_nested_anyof_to_check_validation_semantics_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_nested_anyof_to_check_validation_semantics_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_nested_anyof_to_check_validation_semantics.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostNestedAnyofToCheckValidationSemanticsRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_nested_anyof_to_check_validation_semantics_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_nested_anyof_to_check_validation_semantics_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_nested_anyof_to_check_validation_semantics_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_nested_anyof_to_check_validation_semantics_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_nested_anyof_to_check_validation_semantics_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_nested_anyof_to_check_validation_semantics_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_nested_anyof_to_check_validation_semantics_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_nested_anyof_to_check_validation_semantics_request_body/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_nested_anyof_to_check_validation_semantics_request_body/post/__init__.py new file mode 100644 index 00000000000..8ed6bbc08d0 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_nested_anyof_to_check_validation_semantics_request_body/post/__init__.py @@ -0,0 +1,291 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.nested_anyof_to_check_validation_semantics import NestedAnyofToCheckValidationSemantics + +from .. import path +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = NestedAnyofToCheckValidationSemantics + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + +_status_code_to_response = { + '200': response_for_200.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _post_nested_anyof_to_check_validation_semantics_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_nested_anyof_to_check_validation_semantics_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_nested_anyof_to_check_validation_semantics_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_nested_anyof_to_check_validation_semantics_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_nested_anyof_to_check_validation_semantics_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostNestedAnyofToCheckValidationSemanticsRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_nested_anyof_to_check_validation_semantics_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_nested_anyof_to_check_validation_semantics_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_nested_anyof_to_check_validation_semantics_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_nested_anyof_to_check_validation_semantics_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_nested_anyof_to_check_validation_semantics_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_nested_anyof_to_check_validation_semantics_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_nested_anyof_to_check_validation_semantics_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_nested_anyof_to_check_validation_semantics_request_body/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_nested_anyof_to_check_validation_semantics_request_body/post/__init__.pyi new file mode 100644 index 00000000000..93ab8652c75 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_nested_anyof_to_check_validation_semantics_request_body/post/__init__.pyi @@ -0,0 +1,286 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.nested_anyof_to_check_validation_semantics import NestedAnyofToCheckValidationSemantics + +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = NestedAnyofToCheckValidationSemantics + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_nested_anyof_to_check_validation_semantics_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_nested_anyof_to_check_validation_semantics_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_nested_anyof_to_check_validation_semantics_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_nested_anyof_to_check_validation_semantics_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_nested_anyof_to_check_validation_semantics_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostNestedAnyofToCheckValidationSemanticsRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_nested_anyof_to_check_validation_semantics_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_nested_anyof_to_check_validation_semantics_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_nested_anyof_to_check_validation_semantics_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_nested_anyof_to_check_validation_semantics_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_nested_anyof_to_check_validation_semantics_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_nested_anyof_to_check_validation_semantics_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_nested_anyof_to_check_validation_semantics_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_nested_anyof_to_check_validation_semantics_request_body/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_nested_anyof_to_check_validation_semantics_request_body/post/response_for_200.py new file mode 100644 index 00000000000..ce057133be3 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_nested_anyof_to_check_validation_semantics_request_body/post/response_for_200.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_nested_items_request_body/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_nested_items_request_body/post.py deleted file mode 100644 index 2072cebde77..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_nested_items_request_body/post.py +++ /dev/null @@ -1,298 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.nested_items import NestedItems - -from . import path - -# body param -SchemaForRequestBodyApplicationJson = NestedItems - - -request_body_nested_items = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) -_status_code_to_response = { - '200': _response_for_200, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _post_nested_items_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_nested_items_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_nested_items_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_nested_items_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_nested_items_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_nested_items.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostNestedItemsRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_nested_items_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_nested_items_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_nested_items_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_nested_items_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_nested_items_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_nested_items_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_nested_items_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_nested_items_request_body/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_nested_items_request_body/post.pyi deleted file mode 100644 index f46fe5841fc..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_nested_items_request_body/post.pyi +++ /dev/null @@ -1,293 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.nested_items import NestedItems - -# body param -SchemaForRequestBodyApplicationJson = NestedItems - - -request_body_nested_items = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_nested_items_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_nested_items_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_nested_items_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_nested_items_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_nested_items_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_nested_items.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostNestedItemsRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_nested_items_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_nested_items_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_nested_items_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_nested_items_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_nested_items_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_nested_items_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_nested_items_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_nested_items_request_body/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_nested_items_request_body/post/__init__.py new file mode 100644 index 00000000000..6c5cb539202 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_nested_items_request_body/post/__init__.py @@ -0,0 +1,291 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.nested_items import NestedItems + +from .. import path +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = NestedItems + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + +_status_code_to_response = { + '200': response_for_200.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _post_nested_items_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_nested_items_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_nested_items_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_nested_items_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_nested_items_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostNestedItemsRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_nested_items_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_nested_items_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_nested_items_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_nested_items_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_nested_items_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_nested_items_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_nested_items_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_nested_items_request_body/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_nested_items_request_body/post/__init__.pyi new file mode 100644 index 00000000000..351ebebbec9 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_nested_items_request_body/post/__init__.pyi @@ -0,0 +1,286 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.nested_items import NestedItems + +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = NestedItems + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_nested_items_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_nested_items_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_nested_items_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_nested_items_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_nested_items_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostNestedItemsRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_nested_items_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_nested_items_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_nested_items_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_nested_items_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_nested_items_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_nested_items_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_nested_items_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_nested_items_request_body/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_nested_items_request_body/post/response_for_200.py new file mode 100644 index 00000000000..ce057133be3 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_nested_items_request_body/post/response_for_200.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_nested_oneof_to_check_validation_semantics_request_body/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_nested_oneof_to_check_validation_semantics_request_body/post.py deleted file mode 100644 index eeeb6bfee2f..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_nested_oneof_to_check_validation_semantics_request_body/post.py +++ /dev/null @@ -1,298 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.nested_oneof_to_check_validation_semantics import NestedOneofToCheckValidationSemantics - -from . import path - -# body param -SchemaForRequestBodyApplicationJson = NestedOneofToCheckValidationSemantics - - -request_body_nested_oneof_to_check_validation_semantics = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) -_status_code_to_response = { - '200': _response_for_200, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _post_nested_oneof_to_check_validation_semantics_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_nested_oneof_to_check_validation_semantics_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_nested_oneof_to_check_validation_semantics_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_nested_oneof_to_check_validation_semantics_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_nested_oneof_to_check_validation_semantics_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_nested_oneof_to_check_validation_semantics.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostNestedOneofToCheckValidationSemanticsRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_nested_oneof_to_check_validation_semantics_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_nested_oneof_to_check_validation_semantics_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_nested_oneof_to_check_validation_semantics_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_nested_oneof_to_check_validation_semantics_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_nested_oneof_to_check_validation_semantics_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_nested_oneof_to_check_validation_semantics_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_nested_oneof_to_check_validation_semantics_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_nested_oneof_to_check_validation_semantics_request_body/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_nested_oneof_to_check_validation_semantics_request_body/post.pyi deleted file mode 100644 index fa49ae4894c..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_nested_oneof_to_check_validation_semantics_request_body/post.pyi +++ /dev/null @@ -1,293 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.nested_oneof_to_check_validation_semantics import NestedOneofToCheckValidationSemantics - -# body param -SchemaForRequestBodyApplicationJson = NestedOneofToCheckValidationSemantics - - -request_body_nested_oneof_to_check_validation_semantics = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_nested_oneof_to_check_validation_semantics_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_nested_oneof_to_check_validation_semantics_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_nested_oneof_to_check_validation_semantics_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_nested_oneof_to_check_validation_semantics_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_nested_oneof_to_check_validation_semantics_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_nested_oneof_to_check_validation_semantics.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostNestedOneofToCheckValidationSemanticsRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_nested_oneof_to_check_validation_semantics_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_nested_oneof_to_check_validation_semantics_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_nested_oneof_to_check_validation_semantics_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_nested_oneof_to_check_validation_semantics_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_nested_oneof_to_check_validation_semantics_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_nested_oneof_to_check_validation_semantics_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_nested_oneof_to_check_validation_semantics_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_nested_oneof_to_check_validation_semantics_request_body/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_nested_oneof_to_check_validation_semantics_request_body/post/__init__.py new file mode 100644 index 00000000000..0f43316163f --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_nested_oneof_to_check_validation_semantics_request_body/post/__init__.py @@ -0,0 +1,291 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.nested_oneof_to_check_validation_semantics import NestedOneofToCheckValidationSemantics + +from .. import path +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = NestedOneofToCheckValidationSemantics + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + +_status_code_to_response = { + '200': response_for_200.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _post_nested_oneof_to_check_validation_semantics_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_nested_oneof_to_check_validation_semantics_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_nested_oneof_to_check_validation_semantics_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_nested_oneof_to_check_validation_semantics_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_nested_oneof_to_check_validation_semantics_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostNestedOneofToCheckValidationSemanticsRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_nested_oneof_to_check_validation_semantics_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_nested_oneof_to_check_validation_semantics_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_nested_oneof_to_check_validation_semantics_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_nested_oneof_to_check_validation_semantics_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_nested_oneof_to_check_validation_semantics_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_nested_oneof_to_check_validation_semantics_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_nested_oneof_to_check_validation_semantics_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_nested_oneof_to_check_validation_semantics_request_body/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_nested_oneof_to_check_validation_semantics_request_body/post/__init__.pyi new file mode 100644 index 00000000000..dd705e24fbc --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_nested_oneof_to_check_validation_semantics_request_body/post/__init__.pyi @@ -0,0 +1,286 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.nested_oneof_to_check_validation_semantics import NestedOneofToCheckValidationSemantics + +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = NestedOneofToCheckValidationSemantics + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_nested_oneof_to_check_validation_semantics_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_nested_oneof_to_check_validation_semantics_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_nested_oneof_to_check_validation_semantics_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_nested_oneof_to_check_validation_semantics_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_nested_oneof_to_check_validation_semantics_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostNestedOneofToCheckValidationSemanticsRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_nested_oneof_to_check_validation_semantics_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_nested_oneof_to_check_validation_semantics_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_nested_oneof_to_check_validation_semantics_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_nested_oneof_to_check_validation_semantics_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_nested_oneof_to_check_validation_semantics_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_nested_oneof_to_check_validation_semantics_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_nested_oneof_to_check_validation_semantics_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_nested_oneof_to_check_validation_semantics_request_body/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_nested_oneof_to_check_validation_semantics_request_body/post/response_for_200.py new file mode 100644 index 00000000000..ce057133be3 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_nested_oneof_to_check_validation_semantics_request_body/post/response_for_200.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_not_more_complex_schema_request_body/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_not_more_complex_schema_request_body/post.py deleted file mode 100644 index 7d44a344cc2..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_not_more_complex_schema_request_body/post.py +++ /dev/null @@ -1,367 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from . import path - -# body param - - -class SchemaForRequestBodyApplicationJson( - schemas.ComposedSchema, -): - - - class MetaOapg: - - - class not_schema( - schemas.DictSchema - ): - - - class MetaOapg: - - class properties: - foo = schemas.StrSchema - __annotations__ = { - "foo": foo, - } - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["foo"]) -> MetaOapg.properties.foo: ... - - @typing.overload - def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... - - def __getitem__(self, name: typing.Union[typing_extensions.Literal["foo", ], str]): - # dict_instance[name] accessor - return super().__getitem__(name) - - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["foo"]) -> typing.Union[MetaOapg.properties.foo, schemas.Unset]: ... - - @typing.overload - def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... - - def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["foo", ], str]): - return super().get_item_oapg(name) - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, ], - foo: typing.Union[MetaOapg.properties.foo, str, schemas.Unset] = schemas.unset, - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'not_schema': - return super().__new__( - cls, - *args, - foo=foo, - _configuration=_configuration, - **kwargs, - ) - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'SchemaForRequestBodyApplicationJson': - return super().__new__( - cls, - *args, - _configuration=_configuration, - **kwargs, - ) - - -request_body_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) -_status_code_to_response = { - '200': _response_for_200, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _post_not_more_complex_schema_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_not_more_complex_schema_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_not_more_complex_schema_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_not_more_complex_schema_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_not_more_complex_schema_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostNotMoreComplexSchemaRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_not_more_complex_schema_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_not_more_complex_schema_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_not_more_complex_schema_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_not_more_complex_schema_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_not_more_complex_schema_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_not_more_complex_schema_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_not_more_complex_schema_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_not_more_complex_schema_request_body/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_not_more_complex_schema_request_body/post.pyi deleted file mode 100644 index 5f1d96b0b86..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_not_more_complex_schema_request_body/post.pyi +++ /dev/null @@ -1,362 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -# body param - - -class SchemaForRequestBodyApplicationJson( - schemas.ComposedSchema, -): - - - class MetaOapg: - - - class not_schema( - schemas.DictSchema - ): - - - class MetaOapg: - - class properties: - foo = schemas.StrSchema - __annotations__ = { - "foo": foo, - } - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["foo"]) -> MetaOapg.properties.foo: ... - - @typing.overload - def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... - - def __getitem__(self, name: typing.Union[typing_extensions.Literal["foo", ], str]): - # dict_instance[name] accessor - return super().__getitem__(name) - - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["foo"]) -> typing.Union[MetaOapg.properties.foo, schemas.Unset]: ... - - @typing.overload - def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... - - def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["foo", ], str]): - return super().get_item_oapg(name) - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, ], - foo: typing.Union[MetaOapg.properties.foo, str, schemas.Unset] = schemas.unset, - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'not_schema': - return super().__new__( - cls, - *args, - foo=foo, - _configuration=_configuration, - **kwargs, - ) - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'SchemaForRequestBodyApplicationJson': - return super().__new__( - cls, - *args, - _configuration=_configuration, - **kwargs, - ) - - -request_body_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_not_more_complex_schema_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_not_more_complex_schema_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_not_more_complex_schema_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_not_more_complex_schema_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_not_more_complex_schema_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostNotMoreComplexSchemaRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_not_more_complex_schema_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_not_more_complex_schema_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_not_more_complex_schema_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_not_more_complex_schema_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_not_more_complex_schema_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_not_more_complex_schema_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_not_more_complex_schema_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_not_more_complex_schema_request_body/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_not_more_complex_schema_request_body/post/__init__.py new file mode 100644 index 00000000000..54e34e96f6b --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_not_more_complex_schema_request_body/post/__init__.py @@ -0,0 +1,291 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.not_more_complex_schema import NotMoreComplexSchema + +from .. import path +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = NotMoreComplexSchema + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + +_status_code_to_response = { + '200': response_for_200.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _post_not_more_complex_schema_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_not_more_complex_schema_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_not_more_complex_schema_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_not_more_complex_schema_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_not_more_complex_schema_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostNotMoreComplexSchemaRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_not_more_complex_schema_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_not_more_complex_schema_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_not_more_complex_schema_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_not_more_complex_schema_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_not_more_complex_schema_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_not_more_complex_schema_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_not_more_complex_schema_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_not_more_complex_schema_request_body/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_not_more_complex_schema_request_body/post/__init__.pyi new file mode 100644 index 00000000000..a95b6367ff9 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_not_more_complex_schema_request_body/post/__init__.pyi @@ -0,0 +1,286 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.not_more_complex_schema import NotMoreComplexSchema + +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = NotMoreComplexSchema + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_not_more_complex_schema_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_not_more_complex_schema_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_not_more_complex_schema_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_not_more_complex_schema_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_not_more_complex_schema_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostNotMoreComplexSchemaRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_not_more_complex_schema_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_not_more_complex_schema_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_not_more_complex_schema_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_not_more_complex_schema_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_not_more_complex_schema_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_not_more_complex_schema_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_not_more_complex_schema_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_not_more_complex_schema_request_body/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_not_more_complex_schema_request_body/post/response_for_200.py new file mode 100644 index 00000000000..ce057133be3 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_not_more_complex_schema_request_body/post/response_for_200.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_not_request_body/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_not_request_body/post.py deleted file mode 100644 index 1fdc4937405..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_not_request_body/post.py +++ /dev/null @@ -1,318 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from . import path - -# body param - - -class SchemaForRequestBodyApplicationJson( - schemas.ComposedSchema, -): - - - class MetaOapg: - not_schema = schemas.IntSchema - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'SchemaForRequestBodyApplicationJson': - return super().__new__( - cls, - *args, - _configuration=_configuration, - **kwargs, - ) - - -request_body_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) -_status_code_to_response = { - '200': _response_for_200, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _post_not_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_not_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_not_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_not_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_not_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostNotRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_not_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_not_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_not_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_not_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_not_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_not_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_not_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_not_request_body/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_not_request_body/post.pyi deleted file mode 100644 index ef2e02253ee..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_not_request_body/post.pyi +++ /dev/null @@ -1,313 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -# body param - - -class SchemaForRequestBodyApplicationJson( - schemas.ComposedSchema, -): - - - class MetaOapg: - not_schema = schemas.IntSchema - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'SchemaForRequestBodyApplicationJson': - return super().__new__( - cls, - *args, - _configuration=_configuration, - **kwargs, - ) - - -request_body_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_not_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_not_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_not_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_not_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_not_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostNotRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_not_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_not_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_not_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_not_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_not_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_not_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_not_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_not_request_body/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_not_request_body/post/__init__.py new file mode 100644 index 00000000000..782c06f820c --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_not_request_body/post/__init__.py @@ -0,0 +1,291 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.model_not import ModelNot + +from .. import path +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = ModelNot + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + +_status_code_to_response = { + '200': response_for_200.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _post_not_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_not_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_not_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_not_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_not_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostNotRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_not_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_not_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_not_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_not_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_not_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_not_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_not_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_not_request_body/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_not_request_body/post/__init__.pyi new file mode 100644 index 00000000000..dc239610dce --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_not_request_body/post/__init__.pyi @@ -0,0 +1,286 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.model_not import ModelNot + +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = ModelNot + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_not_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_not_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_not_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_not_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_not_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostNotRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_not_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_not_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_not_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_not_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_not_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_not_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_not_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_not_request_body/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_not_request_body/post/response_for_200.py new file mode 100644 index 00000000000..ce057133be3 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_not_request_body/post/response_for_200.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_nul_characters_in_strings_request_body/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_nul_characters_in_strings_request_body/post.py deleted file mode 100644 index d4b9e53a033..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_nul_characters_in_strings_request_body/post.py +++ /dev/null @@ -1,298 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.nul_characters_in_strings import NulCharactersInStrings - -from . import path - -# body param -SchemaForRequestBodyApplicationJson = NulCharactersInStrings - - -request_body_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) -_status_code_to_response = { - '200': _response_for_200, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _post_nul_characters_in_strings_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_nul_characters_in_strings_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_nul_characters_in_strings_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_nul_characters_in_strings_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_nul_characters_in_strings_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostNulCharactersInStringsRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_nul_characters_in_strings_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_nul_characters_in_strings_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_nul_characters_in_strings_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_nul_characters_in_strings_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_nul_characters_in_strings_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_nul_characters_in_strings_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_nul_characters_in_strings_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_nul_characters_in_strings_request_body/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_nul_characters_in_strings_request_body/post.pyi deleted file mode 100644 index 7445caa5a56..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_nul_characters_in_strings_request_body/post.pyi +++ /dev/null @@ -1,293 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.nul_characters_in_strings import NulCharactersInStrings - -# body param -SchemaForRequestBodyApplicationJson = NulCharactersInStrings - - -request_body_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_nul_characters_in_strings_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_nul_characters_in_strings_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_nul_characters_in_strings_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_nul_characters_in_strings_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_nul_characters_in_strings_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostNulCharactersInStringsRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_nul_characters_in_strings_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_nul_characters_in_strings_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_nul_characters_in_strings_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_nul_characters_in_strings_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_nul_characters_in_strings_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_nul_characters_in_strings_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_nul_characters_in_strings_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_nul_characters_in_strings_request_body/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_nul_characters_in_strings_request_body/post/__init__.py new file mode 100644 index 00000000000..2c1b1825f8c --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_nul_characters_in_strings_request_body/post/__init__.py @@ -0,0 +1,291 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.nul_characters_in_strings import NulCharactersInStrings + +from .. import path +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = NulCharactersInStrings + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + +_status_code_to_response = { + '200': response_for_200.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _post_nul_characters_in_strings_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_nul_characters_in_strings_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_nul_characters_in_strings_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_nul_characters_in_strings_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_nul_characters_in_strings_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostNulCharactersInStringsRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_nul_characters_in_strings_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_nul_characters_in_strings_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_nul_characters_in_strings_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_nul_characters_in_strings_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_nul_characters_in_strings_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_nul_characters_in_strings_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_nul_characters_in_strings_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_nul_characters_in_strings_request_body/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_nul_characters_in_strings_request_body/post/__init__.pyi new file mode 100644 index 00000000000..e4a72120461 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_nul_characters_in_strings_request_body/post/__init__.pyi @@ -0,0 +1,286 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.nul_characters_in_strings import NulCharactersInStrings + +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = NulCharactersInStrings + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_nul_characters_in_strings_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_nul_characters_in_strings_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_nul_characters_in_strings_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_nul_characters_in_strings_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_nul_characters_in_strings_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostNulCharactersInStringsRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_nul_characters_in_strings_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_nul_characters_in_strings_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_nul_characters_in_strings_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_nul_characters_in_strings_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_nul_characters_in_strings_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_nul_characters_in_strings_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_nul_characters_in_strings_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_nul_characters_in_strings_request_body/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_nul_characters_in_strings_request_body/post/response_for_200.py new file mode 100644 index 00000000000..ce057133be3 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_nul_characters_in_strings_request_body/post/response_for_200.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_null_type_matches_only_the_null_object_request_body/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_null_type_matches_only_the_null_object_request_body/post.py deleted file mode 100644 index c94d8b66af9..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_null_type_matches_only_the_null_object_request_body/post.py +++ /dev/null @@ -1,296 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from . import path - -# body param -SchemaForRequestBodyApplicationJson = schemas.NoneSchema - - -request_body_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) -_status_code_to_response = { - '200': _response_for_200, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _post_null_type_matches_only_the_null_object_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,None, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_null_type_matches_only_the_null_object_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,None, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_null_type_matches_only_the_null_object_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,None, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_null_type_matches_only_the_null_object_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,None, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_null_type_matches_only_the_null_object_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,None, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostNullTypeMatchesOnlyTheNullObjectRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_null_type_matches_only_the_null_object_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,None, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_null_type_matches_only_the_null_object_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,None, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_null_type_matches_only_the_null_object_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,None, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_null_type_matches_only_the_null_object_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,None, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_null_type_matches_only_the_null_object_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,None, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_null_type_matches_only_the_null_object_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,None, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,None, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,None, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,None, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,None, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_null_type_matches_only_the_null_object_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_null_type_matches_only_the_null_object_request_body/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_null_type_matches_only_the_null_object_request_body/post.pyi deleted file mode 100644 index 6adc097d24b..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_null_type_matches_only_the_null_object_request_body/post.pyi +++ /dev/null @@ -1,291 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -# body param -SchemaForRequestBodyApplicationJson = schemas.NoneSchema - - -request_body_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_null_type_matches_only_the_null_object_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,None, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_null_type_matches_only_the_null_object_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,None, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_null_type_matches_only_the_null_object_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,None, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_null_type_matches_only_the_null_object_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,None, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_null_type_matches_only_the_null_object_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,None, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostNullTypeMatchesOnlyTheNullObjectRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_null_type_matches_only_the_null_object_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,None, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_null_type_matches_only_the_null_object_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,None, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_null_type_matches_only_the_null_object_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,None, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_null_type_matches_only_the_null_object_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,None, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_null_type_matches_only_the_null_object_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,None, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_null_type_matches_only_the_null_object_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,None, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,None, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,None, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,None, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,None, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_null_type_matches_only_the_null_object_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_null_type_matches_only_the_null_object_request_body/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_null_type_matches_only_the_null_object_request_body/post/__init__.py new file mode 100644 index 00000000000..a165a22e182 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_null_type_matches_only_the_null_object_request_body/post/__init__.py @@ -0,0 +1,291 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.null_type_matches_only_the_null_object import NullTypeMatchesOnlyTheNullObject + +from .. import path +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = NullTypeMatchesOnlyTheNullObject + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + +_status_code_to_response = { + '200': response_for_200.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _post_null_type_matches_only_the_null_object_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_null_type_matches_only_the_null_object_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_null_type_matches_only_the_null_object_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_null_type_matches_only_the_null_object_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_null_type_matches_only_the_null_object_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostNullTypeMatchesOnlyTheNullObjectRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_null_type_matches_only_the_null_object_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_null_type_matches_only_the_null_object_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_null_type_matches_only_the_null_object_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_null_type_matches_only_the_null_object_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_null_type_matches_only_the_null_object_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_null_type_matches_only_the_null_object_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_null_type_matches_only_the_null_object_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_null_type_matches_only_the_null_object_request_body/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_null_type_matches_only_the_null_object_request_body/post/__init__.pyi new file mode 100644 index 00000000000..2657018917c --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_null_type_matches_only_the_null_object_request_body/post/__init__.pyi @@ -0,0 +1,286 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.null_type_matches_only_the_null_object import NullTypeMatchesOnlyTheNullObject + +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = NullTypeMatchesOnlyTheNullObject + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_null_type_matches_only_the_null_object_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_null_type_matches_only_the_null_object_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_null_type_matches_only_the_null_object_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_null_type_matches_only_the_null_object_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_null_type_matches_only_the_null_object_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostNullTypeMatchesOnlyTheNullObjectRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_null_type_matches_only_the_null_object_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_null_type_matches_only_the_null_object_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_null_type_matches_only_the_null_object_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_null_type_matches_only_the_null_object_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_null_type_matches_only_the_null_object_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_null_type_matches_only_the_null_object_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_null_type_matches_only_the_null_object_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_null_type_matches_only_the_null_object_request_body/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_null_type_matches_only_the_null_object_request_body/post/response_for_200.py new file mode 100644 index 00000000000..ce057133be3 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_null_type_matches_only_the_null_object_request_body/post/response_for_200.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_number_type_matches_numbers_request_body/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_number_type_matches_numbers_request_body/post.py deleted file mode 100644 index 1ca41209480..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_number_type_matches_numbers_request_body/post.py +++ /dev/null @@ -1,296 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from . import path - -# body param -SchemaForRequestBodyApplicationJson = schemas.NumberSchema - - -request_body_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) -_status_code_to_response = { - '200': _response_for_200, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _post_number_type_matches_numbers_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,decimal.Decimal, int, float, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_number_type_matches_numbers_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,decimal.Decimal, int, float, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_number_type_matches_numbers_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,decimal.Decimal, int, float, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_number_type_matches_numbers_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,decimal.Decimal, int, float, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_number_type_matches_numbers_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,decimal.Decimal, int, float, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostNumberTypeMatchesNumbersRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_number_type_matches_numbers_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,decimal.Decimal, int, float, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_number_type_matches_numbers_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,decimal.Decimal, int, float, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_number_type_matches_numbers_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,decimal.Decimal, int, float, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_number_type_matches_numbers_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,decimal.Decimal, int, float, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_number_type_matches_numbers_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,decimal.Decimal, int, float, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_number_type_matches_numbers_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,decimal.Decimal, int, float, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,decimal.Decimal, int, float, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,decimal.Decimal, int, float, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,decimal.Decimal, int, float, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,decimal.Decimal, int, float, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_number_type_matches_numbers_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_number_type_matches_numbers_request_body/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_number_type_matches_numbers_request_body/post.pyi deleted file mode 100644 index f4f08b5ead6..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_number_type_matches_numbers_request_body/post.pyi +++ /dev/null @@ -1,291 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -# body param -SchemaForRequestBodyApplicationJson = schemas.NumberSchema - - -request_body_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_number_type_matches_numbers_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,decimal.Decimal, int, float, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_number_type_matches_numbers_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,decimal.Decimal, int, float, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_number_type_matches_numbers_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,decimal.Decimal, int, float, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_number_type_matches_numbers_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,decimal.Decimal, int, float, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_number_type_matches_numbers_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,decimal.Decimal, int, float, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostNumberTypeMatchesNumbersRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_number_type_matches_numbers_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,decimal.Decimal, int, float, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_number_type_matches_numbers_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,decimal.Decimal, int, float, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_number_type_matches_numbers_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,decimal.Decimal, int, float, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_number_type_matches_numbers_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,decimal.Decimal, int, float, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_number_type_matches_numbers_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,decimal.Decimal, int, float, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_number_type_matches_numbers_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,decimal.Decimal, int, float, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,decimal.Decimal, int, float, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,decimal.Decimal, int, float, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,decimal.Decimal, int, float, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,decimal.Decimal, int, float, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_number_type_matches_numbers_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_number_type_matches_numbers_request_body/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_number_type_matches_numbers_request_body/post/__init__.py new file mode 100644 index 00000000000..8d6012d7896 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_number_type_matches_numbers_request_body/post/__init__.py @@ -0,0 +1,291 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.number_type_matches_numbers import NumberTypeMatchesNumbers + +from .. import path +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = NumberTypeMatchesNumbers + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + +_status_code_to_response = { + '200': response_for_200.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _post_number_type_matches_numbers_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_number_type_matches_numbers_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_number_type_matches_numbers_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_number_type_matches_numbers_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_number_type_matches_numbers_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostNumberTypeMatchesNumbersRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_number_type_matches_numbers_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_number_type_matches_numbers_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_number_type_matches_numbers_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_number_type_matches_numbers_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_number_type_matches_numbers_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_number_type_matches_numbers_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_number_type_matches_numbers_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_number_type_matches_numbers_request_body/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_number_type_matches_numbers_request_body/post/__init__.pyi new file mode 100644 index 00000000000..69f6685c750 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_number_type_matches_numbers_request_body/post/__init__.pyi @@ -0,0 +1,286 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.number_type_matches_numbers import NumberTypeMatchesNumbers + +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = NumberTypeMatchesNumbers + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_number_type_matches_numbers_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_number_type_matches_numbers_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_number_type_matches_numbers_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_number_type_matches_numbers_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_number_type_matches_numbers_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostNumberTypeMatchesNumbersRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_number_type_matches_numbers_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_number_type_matches_numbers_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_number_type_matches_numbers_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_number_type_matches_numbers_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_number_type_matches_numbers_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_number_type_matches_numbers_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_number_type_matches_numbers_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_number_type_matches_numbers_request_body/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_number_type_matches_numbers_request_body/post/response_for_200.py new file mode 100644 index 00000000000..ce057133be3 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_number_type_matches_numbers_request_body/post/response_for_200.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_object_properties_validation_request_body/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_object_properties_validation_request_body/post.py deleted file mode 100644 index 6b2af7b5d7a..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_object_properties_validation_request_body/post.py +++ /dev/null @@ -1,298 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.object_properties_validation import ObjectPropertiesValidation - -from . import path - -# body param -SchemaForRequestBodyApplicationJson = ObjectPropertiesValidation - - -request_body_object_properties_validation = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) -_status_code_to_response = { - '200': _response_for_200, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _post_object_properties_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_object_properties_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_object_properties_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_object_properties_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_object_properties_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_object_properties_validation.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostObjectPropertiesValidationRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_object_properties_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_object_properties_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_object_properties_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_object_properties_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_object_properties_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_object_properties_validation_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_object_properties_validation_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_object_properties_validation_request_body/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_object_properties_validation_request_body/post.pyi deleted file mode 100644 index 0a0ecb89fee..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_object_properties_validation_request_body/post.pyi +++ /dev/null @@ -1,293 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.object_properties_validation import ObjectPropertiesValidation - -# body param -SchemaForRequestBodyApplicationJson = ObjectPropertiesValidation - - -request_body_object_properties_validation = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_object_properties_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_object_properties_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_object_properties_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_object_properties_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_object_properties_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_object_properties_validation.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostObjectPropertiesValidationRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_object_properties_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_object_properties_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_object_properties_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_object_properties_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_object_properties_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_object_properties_validation_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_object_properties_validation_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_object_properties_validation_request_body/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_object_properties_validation_request_body/post/__init__.py new file mode 100644 index 00000000000..c79985f9b0a --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_object_properties_validation_request_body/post/__init__.py @@ -0,0 +1,291 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.object_properties_validation import ObjectPropertiesValidation + +from .. import path +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = ObjectPropertiesValidation + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + +_status_code_to_response = { + '200': response_for_200.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _post_object_properties_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_object_properties_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_object_properties_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_object_properties_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_object_properties_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostObjectPropertiesValidationRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_object_properties_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_object_properties_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_object_properties_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_object_properties_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_object_properties_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_object_properties_validation_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_object_properties_validation_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_object_properties_validation_request_body/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_object_properties_validation_request_body/post/__init__.pyi new file mode 100644 index 00000000000..b541e0f8038 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_object_properties_validation_request_body/post/__init__.pyi @@ -0,0 +1,286 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.object_properties_validation import ObjectPropertiesValidation + +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = ObjectPropertiesValidation + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_object_properties_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_object_properties_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_object_properties_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_object_properties_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_object_properties_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostObjectPropertiesValidationRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_object_properties_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_object_properties_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_object_properties_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_object_properties_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_object_properties_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_object_properties_validation_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_object_properties_validation_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_object_properties_validation_request_body/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_object_properties_validation_request_body/post/response_for_200.py new file mode 100644 index 00000000000..ce057133be3 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_object_properties_validation_request_body/post/response_for_200.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_object_type_matches_objects_request_body/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_object_type_matches_objects_request_body/post.py deleted file mode 100644 index 9458ed3bdbb..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_object_type_matches_objects_request_body/post.py +++ /dev/null @@ -1,296 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from . import path - -# body param -SchemaForRequestBodyApplicationJson = schemas.DictSchema - - -request_body_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) -_status_code_to_response = { - '200': _response_for_200, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _post_object_type_matches_objects_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_object_type_matches_objects_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_object_type_matches_objects_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_object_type_matches_objects_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_object_type_matches_objects_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostObjectTypeMatchesObjectsRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_object_type_matches_objects_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_object_type_matches_objects_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_object_type_matches_objects_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_object_type_matches_objects_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_object_type_matches_objects_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_object_type_matches_objects_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_object_type_matches_objects_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_object_type_matches_objects_request_body/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_object_type_matches_objects_request_body/post.pyi deleted file mode 100644 index 26a3aa0e9d7..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_object_type_matches_objects_request_body/post.pyi +++ /dev/null @@ -1,291 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -# body param -SchemaForRequestBodyApplicationJson = schemas.DictSchema - - -request_body_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_object_type_matches_objects_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_object_type_matches_objects_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_object_type_matches_objects_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_object_type_matches_objects_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_object_type_matches_objects_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostObjectTypeMatchesObjectsRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_object_type_matches_objects_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_object_type_matches_objects_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_object_type_matches_objects_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_object_type_matches_objects_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_object_type_matches_objects_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_object_type_matches_objects_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_object_type_matches_objects_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_object_type_matches_objects_request_body/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_object_type_matches_objects_request_body/post/__init__.py new file mode 100644 index 00000000000..8799c026935 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_object_type_matches_objects_request_body/post/__init__.py @@ -0,0 +1,291 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.object_type_matches_objects import ObjectTypeMatchesObjects + +from .. import path +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = ObjectTypeMatchesObjects + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + +_status_code_to_response = { + '200': response_for_200.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _post_object_type_matches_objects_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_object_type_matches_objects_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_object_type_matches_objects_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_object_type_matches_objects_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_object_type_matches_objects_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostObjectTypeMatchesObjectsRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_object_type_matches_objects_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_object_type_matches_objects_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_object_type_matches_objects_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_object_type_matches_objects_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_object_type_matches_objects_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_object_type_matches_objects_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_object_type_matches_objects_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_object_type_matches_objects_request_body/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_object_type_matches_objects_request_body/post/__init__.pyi new file mode 100644 index 00000000000..6f867ff44cf --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_object_type_matches_objects_request_body/post/__init__.pyi @@ -0,0 +1,286 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.object_type_matches_objects import ObjectTypeMatchesObjects + +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = ObjectTypeMatchesObjects + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_object_type_matches_objects_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_object_type_matches_objects_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_object_type_matches_objects_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_object_type_matches_objects_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_object_type_matches_objects_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostObjectTypeMatchesObjectsRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_object_type_matches_objects_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_object_type_matches_objects_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_object_type_matches_objects_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_object_type_matches_objects_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_object_type_matches_objects_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_object_type_matches_objects_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_object_type_matches_objects_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_object_type_matches_objects_request_body/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_object_type_matches_objects_request_body/post/response_for_200.py new file mode 100644 index 00000000000..ce057133be3 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_object_type_matches_objects_request_body/post/response_for_200.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_oneof_complex_types_request_body/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_oneof_complex_types_request_body/post.py deleted file mode 100644 index 1e9c85a757b..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_oneof_complex_types_request_body/post.py +++ /dev/null @@ -1,298 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.oneof_complex_types import OneofComplexTypes - -from . import path - -# body param -SchemaForRequestBodyApplicationJson = OneofComplexTypes - - -request_body_oneof_complex_types = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) -_status_code_to_response = { - '200': _response_for_200, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _post_oneof_complex_types_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_oneof_complex_types_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_oneof_complex_types_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_oneof_complex_types_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_oneof_complex_types_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_oneof_complex_types.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostOneofComplexTypesRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_oneof_complex_types_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_oneof_complex_types_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_oneof_complex_types_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_oneof_complex_types_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_oneof_complex_types_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_oneof_complex_types_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_oneof_complex_types_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_oneof_complex_types_request_body/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_oneof_complex_types_request_body/post.pyi deleted file mode 100644 index 5c61455e783..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_oneof_complex_types_request_body/post.pyi +++ /dev/null @@ -1,293 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.oneof_complex_types import OneofComplexTypes - -# body param -SchemaForRequestBodyApplicationJson = OneofComplexTypes - - -request_body_oneof_complex_types = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_oneof_complex_types_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_oneof_complex_types_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_oneof_complex_types_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_oneof_complex_types_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_oneof_complex_types_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_oneof_complex_types.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostOneofComplexTypesRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_oneof_complex_types_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_oneof_complex_types_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_oneof_complex_types_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_oneof_complex_types_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_oneof_complex_types_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_oneof_complex_types_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_oneof_complex_types_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_oneof_complex_types_request_body/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_oneof_complex_types_request_body/post/__init__.py new file mode 100644 index 00000000000..bb2eb7212e2 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_oneof_complex_types_request_body/post/__init__.py @@ -0,0 +1,291 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.oneof_complex_types import OneofComplexTypes + +from .. import path +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = OneofComplexTypes + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + +_status_code_to_response = { + '200': response_for_200.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _post_oneof_complex_types_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_oneof_complex_types_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_oneof_complex_types_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_oneof_complex_types_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_oneof_complex_types_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostOneofComplexTypesRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_oneof_complex_types_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_oneof_complex_types_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_oneof_complex_types_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_oneof_complex_types_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_oneof_complex_types_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_oneof_complex_types_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_oneof_complex_types_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_oneof_complex_types_request_body/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_oneof_complex_types_request_body/post/__init__.pyi new file mode 100644 index 00000000000..4449576944c --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_oneof_complex_types_request_body/post/__init__.pyi @@ -0,0 +1,286 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.oneof_complex_types import OneofComplexTypes + +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = OneofComplexTypes + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_oneof_complex_types_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_oneof_complex_types_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_oneof_complex_types_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_oneof_complex_types_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_oneof_complex_types_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostOneofComplexTypesRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_oneof_complex_types_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_oneof_complex_types_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_oneof_complex_types_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_oneof_complex_types_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_oneof_complex_types_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_oneof_complex_types_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_oneof_complex_types_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_oneof_complex_types_request_body/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_oneof_complex_types_request_body/post/response_for_200.py new file mode 100644 index 00000000000..ce057133be3 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_oneof_complex_types_request_body/post/response_for_200.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_oneof_request_body/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_oneof_request_body/post.py deleted file mode 100644 index bc372832e58..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_oneof_request_body/post.py +++ /dev/null @@ -1,298 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.oneof import Oneof - -from . import path - -# body param -SchemaForRequestBodyApplicationJson = Oneof - - -request_body_oneof = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) -_status_code_to_response = { - '200': _response_for_200, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _post_oneof_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_oneof_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_oneof_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_oneof_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_oneof_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_oneof.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostOneofRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_oneof_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_oneof_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_oneof_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_oneof_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_oneof_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_oneof_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_oneof_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_oneof_request_body/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_oneof_request_body/post.pyi deleted file mode 100644 index 78a9a83c941..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_oneof_request_body/post.pyi +++ /dev/null @@ -1,293 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.oneof import Oneof - -# body param -SchemaForRequestBodyApplicationJson = Oneof - - -request_body_oneof = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_oneof_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_oneof_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_oneof_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_oneof_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_oneof_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_oneof.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostOneofRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_oneof_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_oneof_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_oneof_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_oneof_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_oneof_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_oneof_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_oneof_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_oneof_request_body/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_oneof_request_body/post/__init__.py new file mode 100644 index 00000000000..b08682e70e5 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_oneof_request_body/post/__init__.py @@ -0,0 +1,291 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.oneof import Oneof + +from .. import path +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = Oneof + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + +_status_code_to_response = { + '200': response_for_200.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _post_oneof_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_oneof_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_oneof_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_oneof_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_oneof_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostOneofRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_oneof_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_oneof_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_oneof_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_oneof_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_oneof_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_oneof_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_oneof_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_oneof_request_body/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_oneof_request_body/post/__init__.pyi new file mode 100644 index 00000000000..e9715379cc2 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_oneof_request_body/post/__init__.pyi @@ -0,0 +1,286 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.oneof import Oneof + +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = Oneof + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_oneof_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_oneof_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_oneof_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_oneof_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_oneof_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostOneofRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_oneof_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_oneof_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_oneof_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_oneof_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_oneof_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_oneof_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_oneof_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_oneof_request_body/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_oneof_request_body/post/response_for_200.py new file mode 100644 index 00000000000..ce057133be3 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_oneof_request_body/post/response_for_200.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_oneof_with_base_schema_request_body/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_oneof_with_base_schema_request_body/post.py deleted file mode 100644 index 8d00db16b53..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_oneof_with_base_schema_request_body/post.py +++ /dev/null @@ -1,298 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.oneof_with_base_schema import OneofWithBaseSchema - -from . import path - -# body param -SchemaForRequestBodyApplicationJson = OneofWithBaseSchema - - -request_body_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) -_status_code_to_response = { - '200': _response_for_200, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _post_oneof_with_base_schema_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_oneof_with_base_schema_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_oneof_with_base_schema_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_oneof_with_base_schema_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_oneof_with_base_schema_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostOneofWithBaseSchemaRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_oneof_with_base_schema_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_oneof_with_base_schema_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_oneof_with_base_schema_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_oneof_with_base_schema_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_oneof_with_base_schema_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_oneof_with_base_schema_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_oneof_with_base_schema_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_oneof_with_base_schema_request_body/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_oneof_with_base_schema_request_body/post.pyi deleted file mode 100644 index 0d4fe45599d..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_oneof_with_base_schema_request_body/post.pyi +++ /dev/null @@ -1,293 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.oneof_with_base_schema import OneofWithBaseSchema - -# body param -SchemaForRequestBodyApplicationJson = OneofWithBaseSchema - - -request_body_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_oneof_with_base_schema_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_oneof_with_base_schema_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_oneof_with_base_schema_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_oneof_with_base_schema_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_oneof_with_base_schema_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostOneofWithBaseSchemaRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_oneof_with_base_schema_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_oneof_with_base_schema_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_oneof_with_base_schema_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_oneof_with_base_schema_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_oneof_with_base_schema_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_oneof_with_base_schema_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_oneof_with_base_schema_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_oneof_with_base_schema_request_body/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_oneof_with_base_schema_request_body/post/__init__.py new file mode 100644 index 00000000000..d4031f08a60 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_oneof_with_base_schema_request_body/post/__init__.py @@ -0,0 +1,291 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.oneof_with_base_schema import OneofWithBaseSchema + +from .. import path +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = OneofWithBaseSchema + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + +_status_code_to_response = { + '200': response_for_200.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _post_oneof_with_base_schema_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_oneof_with_base_schema_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_oneof_with_base_schema_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_oneof_with_base_schema_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_oneof_with_base_schema_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostOneofWithBaseSchemaRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_oneof_with_base_schema_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_oneof_with_base_schema_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_oneof_with_base_schema_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_oneof_with_base_schema_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_oneof_with_base_schema_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_oneof_with_base_schema_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_oneof_with_base_schema_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_oneof_with_base_schema_request_body/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_oneof_with_base_schema_request_body/post/__init__.pyi new file mode 100644 index 00000000000..8381be60394 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_oneof_with_base_schema_request_body/post/__init__.pyi @@ -0,0 +1,286 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.oneof_with_base_schema import OneofWithBaseSchema + +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = OneofWithBaseSchema + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_oneof_with_base_schema_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_oneof_with_base_schema_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_oneof_with_base_schema_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_oneof_with_base_schema_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_oneof_with_base_schema_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostOneofWithBaseSchemaRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_oneof_with_base_schema_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_oneof_with_base_schema_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_oneof_with_base_schema_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_oneof_with_base_schema_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_oneof_with_base_schema_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_oneof_with_base_schema_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_oneof_with_base_schema_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_oneof_with_base_schema_request_body/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_oneof_with_base_schema_request_body/post/response_for_200.py new file mode 100644 index 00000000000..ce057133be3 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_oneof_with_base_schema_request_body/post/response_for_200.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_oneof_with_empty_schema_request_body/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_oneof_with_empty_schema_request_body/post.py deleted file mode 100644 index de00a1e19e9..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_oneof_with_empty_schema_request_body/post.py +++ /dev/null @@ -1,298 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.oneof_with_empty_schema import OneofWithEmptySchema - -from . import path - -# body param -SchemaForRequestBodyApplicationJson = OneofWithEmptySchema - - -request_body_oneof_with_empty_schema = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) -_status_code_to_response = { - '200': _response_for_200, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _post_oneof_with_empty_schema_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_oneof_with_empty_schema_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_oneof_with_empty_schema_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_oneof_with_empty_schema_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_oneof_with_empty_schema_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_oneof_with_empty_schema.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostOneofWithEmptySchemaRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_oneof_with_empty_schema_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_oneof_with_empty_schema_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_oneof_with_empty_schema_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_oneof_with_empty_schema_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_oneof_with_empty_schema_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_oneof_with_empty_schema_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_oneof_with_empty_schema_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_oneof_with_empty_schema_request_body/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_oneof_with_empty_schema_request_body/post.pyi deleted file mode 100644 index 2d419104035..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_oneof_with_empty_schema_request_body/post.pyi +++ /dev/null @@ -1,293 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.oneof_with_empty_schema import OneofWithEmptySchema - -# body param -SchemaForRequestBodyApplicationJson = OneofWithEmptySchema - - -request_body_oneof_with_empty_schema = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_oneof_with_empty_schema_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_oneof_with_empty_schema_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_oneof_with_empty_schema_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_oneof_with_empty_schema_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_oneof_with_empty_schema_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_oneof_with_empty_schema.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostOneofWithEmptySchemaRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_oneof_with_empty_schema_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_oneof_with_empty_schema_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_oneof_with_empty_schema_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_oneof_with_empty_schema_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_oneof_with_empty_schema_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_oneof_with_empty_schema_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_oneof_with_empty_schema_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_oneof_with_empty_schema_request_body/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_oneof_with_empty_schema_request_body/post/__init__.py new file mode 100644 index 00000000000..0ddb60571fa --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_oneof_with_empty_schema_request_body/post/__init__.py @@ -0,0 +1,291 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.oneof_with_empty_schema import OneofWithEmptySchema + +from .. import path +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = OneofWithEmptySchema + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + +_status_code_to_response = { + '200': response_for_200.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _post_oneof_with_empty_schema_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_oneof_with_empty_schema_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_oneof_with_empty_schema_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_oneof_with_empty_schema_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_oneof_with_empty_schema_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostOneofWithEmptySchemaRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_oneof_with_empty_schema_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_oneof_with_empty_schema_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_oneof_with_empty_schema_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_oneof_with_empty_schema_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_oneof_with_empty_schema_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_oneof_with_empty_schema_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_oneof_with_empty_schema_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_oneof_with_empty_schema_request_body/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_oneof_with_empty_schema_request_body/post/__init__.pyi new file mode 100644 index 00000000000..2524b27b8fb --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_oneof_with_empty_schema_request_body/post/__init__.pyi @@ -0,0 +1,286 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.oneof_with_empty_schema import OneofWithEmptySchema + +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = OneofWithEmptySchema + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_oneof_with_empty_schema_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_oneof_with_empty_schema_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_oneof_with_empty_schema_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_oneof_with_empty_schema_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_oneof_with_empty_schema_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostOneofWithEmptySchemaRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_oneof_with_empty_schema_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_oneof_with_empty_schema_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_oneof_with_empty_schema_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_oneof_with_empty_schema_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_oneof_with_empty_schema_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_oneof_with_empty_schema_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_oneof_with_empty_schema_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_oneof_with_empty_schema_request_body/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_oneof_with_empty_schema_request_body/post/response_for_200.py new file mode 100644 index 00000000000..ce057133be3 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_oneof_with_empty_schema_request_body/post/response_for_200.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_oneof_with_required_request_body/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_oneof_with_required_request_body/post.py deleted file mode 100644 index e32e6df399a..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_oneof_with_required_request_body/post.py +++ /dev/null @@ -1,298 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.oneof_with_required import OneofWithRequired - -from . import path - -# body param -SchemaForRequestBodyApplicationJson = OneofWithRequired - - -request_body_oneof_with_required = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) -_status_code_to_response = { - '200': _response_for_200, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _post_oneof_with_required_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_oneof_with_required_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_oneof_with_required_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_oneof_with_required_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_oneof_with_required_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_oneof_with_required.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostOneofWithRequiredRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_oneof_with_required_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_oneof_with_required_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_oneof_with_required_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_oneof_with_required_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_oneof_with_required_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_oneof_with_required_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_oneof_with_required_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_oneof_with_required_request_body/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_oneof_with_required_request_body/post.pyi deleted file mode 100644 index b75ad8f9a94..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_oneof_with_required_request_body/post.pyi +++ /dev/null @@ -1,293 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.oneof_with_required import OneofWithRequired - -# body param -SchemaForRequestBodyApplicationJson = OneofWithRequired - - -request_body_oneof_with_required = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_oneof_with_required_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_oneof_with_required_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_oneof_with_required_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_oneof_with_required_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_oneof_with_required_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_oneof_with_required.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostOneofWithRequiredRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_oneof_with_required_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_oneof_with_required_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_oneof_with_required_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_oneof_with_required_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_oneof_with_required_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_oneof_with_required_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_oneof_with_required_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_oneof_with_required_request_body/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_oneof_with_required_request_body/post/__init__.py new file mode 100644 index 00000000000..519772204e1 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_oneof_with_required_request_body/post/__init__.py @@ -0,0 +1,291 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.oneof_with_required import OneofWithRequired + +from .. import path +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = OneofWithRequired + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + +_status_code_to_response = { + '200': response_for_200.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _post_oneof_with_required_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_oneof_with_required_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_oneof_with_required_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_oneof_with_required_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_oneof_with_required_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostOneofWithRequiredRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_oneof_with_required_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_oneof_with_required_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_oneof_with_required_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_oneof_with_required_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_oneof_with_required_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_oneof_with_required_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_oneof_with_required_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_oneof_with_required_request_body/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_oneof_with_required_request_body/post/__init__.pyi new file mode 100644 index 00000000000..79a3850ddc6 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_oneof_with_required_request_body/post/__init__.pyi @@ -0,0 +1,286 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.oneof_with_required import OneofWithRequired + +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = OneofWithRequired + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_oneof_with_required_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_oneof_with_required_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_oneof_with_required_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_oneof_with_required_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_oneof_with_required_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostOneofWithRequiredRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_oneof_with_required_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_oneof_with_required_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_oneof_with_required_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_oneof_with_required_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_oneof_with_required_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_oneof_with_required_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_oneof_with_required_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_oneof_with_required_request_body/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_oneof_with_required_request_body/post/response_for_200.py new file mode 100644 index 00000000000..ce057133be3 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_oneof_with_required_request_body/post/response_for_200.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_pattern_is_not_anchored_request_body/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_pattern_is_not_anchored_request_body/post.py deleted file mode 100644 index c5120a7acd7..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_pattern_is_not_anchored_request_body/post.py +++ /dev/null @@ -1,298 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.pattern_is_not_anchored import PatternIsNotAnchored - -from . import path - -# body param -SchemaForRequestBodyApplicationJson = PatternIsNotAnchored - - -request_body_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) -_status_code_to_response = { - '200': _response_for_200, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _post_pattern_is_not_anchored_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_pattern_is_not_anchored_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_pattern_is_not_anchored_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_pattern_is_not_anchored_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_pattern_is_not_anchored_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostPatternIsNotAnchoredRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_pattern_is_not_anchored_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_pattern_is_not_anchored_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_pattern_is_not_anchored_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_pattern_is_not_anchored_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_pattern_is_not_anchored_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_pattern_is_not_anchored_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_pattern_is_not_anchored_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_pattern_is_not_anchored_request_body/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_pattern_is_not_anchored_request_body/post.pyi deleted file mode 100644 index 1848470356a..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_pattern_is_not_anchored_request_body/post.pyi +++ /dev/null @@ -1,293 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.pattern_is_not_anchored import PatternIsNotAnchored - -# body param -SchemaForRequestBodyApplicationJson = PatternIsNotAnchored - - -request_body_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_pattern_is_not_anchored_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_pattern_is_not_anchored_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_pattern_is_not_anchored_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_pattern_is_not_anchored_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_pattern_is_not_anchored_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostPatternIsNotAnchoredRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_pattern_is_not_anchored_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_pattern_is_not_anchored_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_pattern_is_not_anchored_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_pattern_is_not_anchored_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_pattern_is_not_anchored_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_pattern_is_not_anchored_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_pattern_is_not_anchored_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_pattern_is_not_anchored_request_body/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_pattern_is_not_anchored_request_body/post/__init__.py new file mode 100644 index 00000000000..026c9447475 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_pattern_is_not_anchored_request_body/post/__init__.py @@ -0,0 +1,291 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.pattern_is_not_anchored import PatternIsNotAnchored + +from .. import path +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = PatternIsNotAnchored + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + +_status_code_to_response = { + '200': response_for_200.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _post_pattern_is_not_anchored_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_pattern_is_not_anchored_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_pattern_is_not_anchored_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_pattern_is_not_anchored_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_pattern_is_not_anchored_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostPatternIsNotAnchoredRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_pattern_is_not_anchored_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_pattern_is_not_anchored_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_pattern_is_not_anchored_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_pattern_is_not_anchored_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_pattern_is_not_anchored_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_pattern_is_not_anchored_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_pattern_is_not_anchored_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_pattern_is_not_anchored_request_body/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_pattern_is_not_anchored_request_body/post/__init__.pyi new file mode 100644 index 00000000000..c9b29dafde0 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_pattern_is_not_anchored_request_body/post/__init__.pyi @@ -0,0 +1,286 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.pattern_is_not_anchored import PatternIsNotAnchored + +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = PatternIsNotAnchored + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_pattern_is_not_anchored_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_pattern_is_not_anchored_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_pattern_is_not_anchored_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_pattern_is_not_anchored_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_pattern_is_not_anchored_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostPatternIsNotAnchoredRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_pattern_is_not_anchored_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_pattern_is_not_anchored_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_pattern_is_not_anchored_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_pattern_is_not_anchored_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_pattern_is_not_anchored_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_pattern_is_not_anchored_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_pattern_is_not_anchored_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_pattern_is_not_anchored_request_body/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_pattern_is_not_anchored_request_body/post/response_for_200.py new file mode 100644 index 00000000000..ce057133be3 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_pattern_is_not_anchored_request_body/post/response_for_200.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_pattern_validation_request_body/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_pattern_validation_request_body/post.py deleted file mode 100644 index 422b433e46e..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_pattern_validation_request_body/post.py +++ /dev/null @@ -1,298 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.pattern_validation import PatternValidation - -from . import path - -# body param -SchemaForRequestBodyApplicationJson = PatternValidation - - -request_body_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) -_status_code_to_response = { - '200': _response_for_200, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _post_pattern_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_pattern_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_pattern_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_pattern_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_pattern_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostPatternValidationRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_pattern_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_pattern_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_pattern_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_pattern_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_pattern_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_pattern_validation_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_pattern_validation_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_pattern_validation_request_body/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_pattern_validation_request_body/post.pyi deleted file mode 100644 index d8126709666..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_pattern_validation_request_body/post.pyi +++ /dev/null @@ -1,293 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.pattern_validation import PatternValidation - -# body param -SchemaForRequestBodyApplicationJson = PatternValidation - - -request_body_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_pattern_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_pattern_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_pattern_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_pattern_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_pattern_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostPatternValidationRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_pattern_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_pattern_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_pattern_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_pattern_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_pattern_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_pattern_validation_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_pattern_validation_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_pattern_validation_request_body/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_pattern_validation_request_body/post/__init__.py new file mode 100644 index 00000000000..1bb3cf76ca0 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_pattern_validation_request_body/post/__init__.py @@ -0,0 +1,291 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.pattern_validation import PatternValidation + +from .. import path +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = PatternValidation + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + +_status_code_to_response = { + '200': response_for_200.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _post_pattern_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_pattern_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_pattern_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_pattern_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_pattern_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostPatternValidationRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_pattern_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_pattern_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_pattern_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_pattern_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_pattern_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_pattern_validation_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_pattern_validation_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_pattern_validation_request_body/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_pattern_validation_request_body/post/__init__.pyi new file mode 100644 index 00000000000..fd1a76d3282 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_pattern_validation_request_body/post/__init__.pyi @@ -0,0 +1,286 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.pattern_validation import PatternValidation + +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = PatternValidation + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_pattern_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_pattern_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_pattern_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_pattern_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_pattern_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostPatternValidationRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_pattern_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_pattern_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_pattern_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_pattern_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_pattern_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_pattern_validation_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_pattern_validation_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_pattern_validation_request_body/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_pattern_validation_request_body/post/response_for_200.py new file mode 100644 index 00000000000..ce057133be3 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_pattern_validation_request_body/post/response_for_200.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_properties_with_escaped_characters_request_body/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_properties_with_escaped_characters_request_body/post.py deleted file mode 100644 index bcc74a2ae9f..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_properties_with_escaped_characters_request_body/post.py +++ /dev/null @@ -1,298 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.properties_with_escaped_characters import PropertiesWithEscapedCharacters - -from . import path - -# body param -SchemaForRequestBodyApplicationJson = PropertiesWithEscapedCharacters - - -request_body_properties_with_escaped_characters = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) -_status_code_to_response = { - '200': _response_for_200, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _post_properties_with_escaped_characters_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_properties_with_escaped_characters_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_properties_with_escaped_characters_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_properties_with_escaped_characters_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_properties_with_escaped_characters_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_properties_with_escaped_characters.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostPropertiesWithEscapedCharactersRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_properties_with_escaped_characters_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_properties_with_escaped_characters_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_properties_with_escaped_characters_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_properties_with_escaped_characters_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_properties_with_escaped_characters_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_properties_with_escaped_characters_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_properties_with_escaped_characters_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_properties_with_escaped_characters_request_body/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_properties_with_escaped_characters_request_body/post.pyi deleted file mode 100644 index 1bab1c15f17..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_properties_with_escaped_characters_request_body/post.pyi +++ /dev/null @@ -1,293 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.properties_with_escaped_characters import PropertiesWithEscapedCharacters - -# body param -SchemaForRequestBodyApplicationJson = PropertiesWithEscapedCharacters - - -request_body_properties_with_escaped_characters = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_properties_with_escaped_characters_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_properties_with_escaped_characters_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_properties_with_escaped_characters_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_properties_with_escaped_characters_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_properties_with_escaped_characters_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_properties_with_escaped_characters.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostPropertiesWithEscapedCharactersRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_properties_with_escaped_characters_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_properties_with_escaped_characters_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_properties_with_escaped_characters_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_properties_with_escaped_characters_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_properties_with_escaped_characters_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_properties_with_escaped_characters_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_properties_with_escaped_characters_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_properties_with_escaped_characters_request_body/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_properties_with_escaped_characters_request_body/post/__init__.py new file mode 100644 index 00000000000..649fe0049d4 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_properties_with_escaped_characters_request_body/post/__init__.py @@ -0,0 +1,291 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.properties_with_escaped_characters import PropertiesWithEscapedCharacters + +from .. import path +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = PropertiesWithEscapedCharacters + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + +_status_code_to_response = { + '200': response_for_200.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _post_properties_with_escaped_characters_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_properties_with_escaped_characters_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_properties_with_escaped_characters_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_properties_with_escaped_characters_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_properties_with_escaped_characters_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostPropertiesWithEscapedCharactersRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_properties_with_escaped_characters_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_properties_with_escaped_characters_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_properties_with_escaped_characters_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_properties_with_escaped_characters_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_properties_with_escaped_characters_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_properties_with_escaped_characters_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_properties_with_escaped_characters_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_properties_with_escaped_characters_request_body/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_properties_with_escaped_characters_request_body/post/__init__.pyi new file mode 100644 index 00000000000..cfe13c81d3b --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_properties_with_escaped_characters_request_body/post/__init__.pyi @@ -0,0 +1,286 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.properties_with_escaped_characters import PropertiesWithEscapedCharacters + +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = PropertiesWithEscapedCharacters + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_properties_with_escaped_characters_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_properties_with_escaped_characters_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_properties_with_escaped_characters_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_properties_with_escaped_characters_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_properties_with_escaped_characters_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostPropertiesWithEscapedCharactersRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_properties_with_escaped_characters_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_properties_with_escaped_characters_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_properties_with_escaped_characters_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_properties_with_escaped_characters_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_properties_with_escaped_characters_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_properties_with_escaped_characters_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_properties_with_escaped_characters_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_properties_with_escaped_characters_request_body/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_properties_with_escaped_characters_request_body/post/response_for_200.py new file mode 100644 index 00000000000..ce057133be3 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_properties_with_escaped_characters_request_body/post/response_for_200.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_property_named_ref_that_is_not_a_reference_request_body/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_property_named_ref_that_is_not_a_reference_request_body/post.py deleted file mode 100644 index a176ec4b34e..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_property_named_ref_that_is_not_a_reference_request_body/post.py +++ /dev/null @@ -1,298 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.property_named_ref_that_is_not_a_reference import PropertyNamedRefThatIsNotAReference - -from . import path - -# body param -SchemaForRequestBodyApplicationJson = PropertyNamedRefThatIsNotAReference - - -request_body_property_named_ref_that_is_not_a_reference = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) -_status_code_to_response = { - '200': _response_for_200, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _post_property_named_ref_that_is_not_a_reference_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_property_named_ref_that_is_not_a_reference_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_property_named_ref_that_is_not_a_reference_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_property_named_ref_that_is_not_a_reference_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_property_named_ref_that_is_not_a_reference_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_property_named_ref_that_is_not_a_reference.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostPropertyNamedRefThatIsNotAReferenceRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_property_named_ref_that_is_not_a_reference_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_property_named_ref_that_is_not_a_reference_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_property_named_ref_that_is_not_a_reference_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_property_named_ref_that_is_not_a_reference_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_property_named_ref_that_is_not_a_reference_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_property_named_ref_that_is_not_a_reference_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_property_named_ref_that_is_not_a_reference_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_property_named_ref_that_is_not_a_reference_request_body/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_property_named_ref_that_is_not_a_reference_request_body/post.pyi deleted file mode 100644 index ff3985bce85..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_property_named_ref_that_is_not_a_reference_request_body/post.pyi +++ /dev/null @@ -1,293 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.property_named_ref_that_is_not_a_reference import PropertyNamedRefThatIsNotAReference - -# body param -SchemaForRequestBodyApplicationJson = PropertyNamedRefThatIsNotAReference - - -request_body_property_named_ref_that_is_not_a_reference = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_property_named_ref_that_is_not_a_reference_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_property_named_ref_that_is_not_a_reference_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_property_named_ref_that_is_not_a_reference_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_property_named_ref_that_is_not_a_reference_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_property_named_ref_that_is_not_a_reference_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_property_named_ref_that_is_not_a_reference.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostPropertyNamedRefThatIsNotAReferenceRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_property_named_ref_that_is_not_a_reference_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_property_named_ref_that_is_not_a_reference_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_property_named_ref_that_is_not_a_reference_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_property_named_ref_that_is_not_a_reference_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_property_named_ref_that_is_not_a_reference_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_property_named_ref_that_is_not_a_reference_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_property_named_ref_that_is_not_a_reference_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_property_named_ref_that_is_not_a_reference_request_body/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_property_named_ref_that_is_not_a_reference_request_body/post/__init__.py new file mode 100644 index 00000000000..7560562b022 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_property_named_ref_that_is_not_a_reference_request_body/post/__init__.py @@ -0,0 +1,291 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.property_named_ref_that_is_not_a_reference import PropertyNamedRefThatIsNotAReference + +from .. import path +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = PropertyNamedRefThatIsNotAReference + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + +_status_code_to_response = { + '200': response_for_200.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _post_property_named_ref_that_is_not_a_reference_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_property_named_ref_that_is_not_a_reference_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_property_named_ref_that_is_not_a_reference_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_property_named_ref_that_is_not_a_reference_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_property_named_ref_that_is_not_a_reference_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostPropertyNamedRefThatIsNotAReferenceRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_property_named_ref_that_is_not_a_reference_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_property_named_ref_that_is_not_a_reference_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_property_named_ref_that_is_not_a_reference_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_property_named_ref_that_is_not_a_reference_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_property_named_ref_that_is_not_a_reference_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_property_named_ref_that_is_not_a_reference_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_property_named_ref_that_is_not_a_reference_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_property_named_ref_that_is_not_a_reference_request_body/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_property_named_ref_that_is_not_a_reference_request_body/post/__init__.pyi new file mode 100644 index 00000000000..e5f6205f484 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_property_named_ref_that_is_not_a_reference_request_body/post/__init__.pyi @@ -0,0 +1,286 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.property_named_ref_that_is_not_a_reference import PropertyNamedRefThatIsNotAReference + +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = PropertyNamedRefThatIsNotAReference + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_property_named_ref_that_is_not_a_reference_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_property_named_ref_that_is_not_a_reference_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_property_named_ref_that_is_not_a_reference_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_property_named_ref_that_is_not_a_reference_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_property_named_ref_that_is_not_a_reference_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostPropertyNamedRefThatIsNotAReferenceRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_property_named_ref_that_is_not_a_reference_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_property_named_ref_that_is_not_a_reference_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_property_named_ref_that_is_not_a_reference_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_property_named_ref_that_is_not_a_reference_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_property_named_ref_that_is_not_a_reference_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_property_named_ref_that_is_not_a_reference_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_property_named_ref_that_is_not_a_reference_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_property_named_ref_that_is_not_a_reference_request_body/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_property_named_ref_that_is_not_a_reference_request_body/post/response_for_200.py new file mode 100644 index 00000000000..ce057133be3 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_property_named_ref_that_is_not_a_reference_request_body/post/response_for_200.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ref_in_additionalproperties_request_body/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ref_in_additionalproperties_request_body/post.py deleted file mode 100644 index baae0992b51..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ref_in_additionalproperties_request_body/post.py +++ /dev/null @@ -1,298 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.ref_in_additionalproperties import RefInAdditionalproperties - -from . import path - -# body param -SchemaForRequestBodyApplicationJson = RefInAdditionalproperties - - -request_body_ref_in_additionalproperties = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) -_status_code_to_response = { - '200': _response_for_200, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _post_ref_in_additionalproperties_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_ref_in_additionalproperties_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_ref_in_additionalproperties_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_ref_in_additionalproperties_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_ref_in_additionalproperties_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_ref_in_additionalproperties.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostRefInAdditionalpropertiesRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_ref_in_additionalproperties_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_ref_in_additionalproperties_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_ref_in_additionalproperties_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_ref_in_additionalproperties_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_ref_in_additionalproperties_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_ref_in_additionalproperties_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_ref_in_additionalproperties_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ref_in_additionalproperties_request_body/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ref_in_additionalproperties_request_body/post.pyi deleted file mode 100644 index ae66e236baa..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ref_in_additionalproperties_request_body/post.pyi +++ /dev/null @@ -1,293 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.ref_in_additionalproperties import RefInAdditionalproperties - -# body param -SchemaForRequestBodyApplicationJson = RefInAdditionalproperties - - -request_body_ref_in_additionalproperties = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_ref_in_additionalproperties_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_ref_in_additionalproperties_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_ref_in_additionalproperties_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_ref_in_additionalproperties_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_ref_in_additionalproperties_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_ref_in_additionalproperties.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostRefInAdditionalpropertiesRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_ref_in_additionalproperties_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_ref_in_additionalproperties_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_ref_in_additionalproperties_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_ref_in_additionalproperties_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_ref_in_additionalproperties_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_ref_in_additionalproperties_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_ref_in_additionalproperties_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ref_in_additionalproperties_request_body/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ref_in_additionalproperties_request_body/post/__init__.py new file mode 100644 index 00000000000..81d25a6ac05 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ref_in_additionalproperties_request_body/post/__init__.py @@ -0,0 +1,291 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.ref_in_additionalproperties import RefInAdditionalproperties + +from .. import path +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = RefInAdditionalproperties + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + +_status_code_to_response = { + '200': response_for_200.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _post_ref_in_additionalproperties_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_ref_in_additionalproperties_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_ref_in_additionalproperties_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_ref_in_additionalproperties_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_ref_in_additionalproperties_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostRefInAdditionalpropertiesRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_ref_in_additionalproperties_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_ref_in_additionalproperties_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_ref_in_additionalproperties_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_ref_in_additionalproperties_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_ref_in_additionalproperties_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_ref_in_additionalproperties_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_ref_in_additionalproperties_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ref_in_additionalproperties_request_body/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ref_in_additionalproperties_request_body/post/__init__.pyi new file mode 100644 index 00000000000..78edf0a05e2 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ref_in_additionalproperties_request_body/post/__init__.pyi @@ -0,0 +1,286 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.ref_in_additionalproperties import RefInAdditionalproperties + +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = RefInAdditionalproperties + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_ref_in_additionalproperties_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_ref_in_additionalproperties_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_ref_in_additionalproperties_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_ref_in_additionalproperties_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_ref_in_additionalproperties_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostRefInAdditionalpropertiesRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_ref_in_additionalproperties_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_ref_in_additionalproperties_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_ref_in_additionalproperties_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_ref_in_additionalproperties_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_ref_in_additionalproperties_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_ref_in_additionalproperties_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_ref_in_additionalproperties_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ref_in_additionalproperties_request_body/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ref_in_additionalproperties_request_body/post/response_for_200.py new file mode 100644 index 00000000000..ce057133be3 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ref_in_additionalproperties_request_body/post/response_for_200.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ref_in_allof_request_body/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ref_in_allof_request_body/post.py deleted file mode 100644 index 32d5d6cba98..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ref_in_allof_request_body/post.py +++ /dev/null @@ -1,298 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.ref_in_allof import RefInAllof - -from . import path - -# body param -SchemaForRequestBodyApplicationJson = RefInAllof - - -request_body_ref_in_allof = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) -_status_code_to_response = { - '200': _response_for_200, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _post_ref_in_allof_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_ref_in_allof_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_ref_in_allof_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_ref_in_allof_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_ref_in_allof_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_ref_in_allof.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostRefInAllofRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_ref_in_allof_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_ref_in_allof_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_ref_in_allof_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_ref_in_allof_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_ref_in_allof_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_ref_in_allof_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_ref_in_allof_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ref_in_allof_request_body/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ref_in_allof_request_body/post.pyi deleted file mode 100644 index 6eddfe043b5..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ref_in_allof_request_body/post.pyi +++ /dev/null @@ -1,293 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.ref_in_allof import RefInAllof - -# body param -SchemaForRequestBodyApplicationJson = RefInAllof - - -request_body_ref_in_allof = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_ref_in_allof_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_ref_in_allof_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_ref_in_allof_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_ref_in_allof_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_ref_in_allof_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_ref_in_allof.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostRefInAllofRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_ref_in_allof_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_ref_in_allof_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_ref_in_allof_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_ref_in_allof_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_ref_in_allof_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_ref_in_allof_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_ref_in_allof_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ref_in_allof_request_body/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ref_in_allof_request_body/post/__init__.py new file mode 100644 index 00000000000..dc03e779ccc --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ref_in_allof_request_body/post/__init__.py @@ -0,0 +1,291 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.ref_in_allof import RefInAllof + +from .. import path +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = RefInAllof + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + +_status_code_to_response = { + '200': response_for_200.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _post_ref_in_allof_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_ref_in_allof_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_ref_in_allof_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_ref_in_allof_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_ref_in_allof_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostRefInAllofRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_ref_in_allof_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_ref_in_allof_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_ref_in_allof_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_ref_in_allof_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_ref_in_allof_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_ref_in_allof_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_ref_in_allof_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ref_in_allof_request_body/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ref_in_allof_request_body/post/__init__.pyi new file mode 100644 index 00000000000..e0699b64553 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ref_in_allof_request_body/post/__init__.pyi @@ -0,0 +1,286 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.ref_in_allof import RefInAllof + +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = RefInAllof + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_ref_in_allof_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_ref_in_allof_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_ref_in_allof_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_ref_in_allof_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_ref_in_allof_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostRefInAllofRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_ref_in_allof_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_ref_in_allof_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_ref_in_allof_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_ref_in_allof_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_ref_in_allof_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_ref_in_allof_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_ref_in_allof_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ref_in_allof_request_body/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ref_in_allof_request_body/post/response_for_200.py new file mode 100644 index 00000000000..ce057133be3 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ref_in_allof_request_body/post/response_for_200.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ref_in_anyof_request_body/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ref_in_anyof_request_body/post.py deleted file mode 100644 index c61b0c03460..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ref_in_anyof_request_body/post.py +++ /dev/null @@ -1,298 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.ref_in_anyof import RefInAnyof - -from . import path - -# body param -SchemaForRequestBodyApplicationJson = RefInAnyof - - -request_body_ref_in_anyof = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) -_status_code_to_response = { - '200': _response_for_200, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _post_ref_in_anyof_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_ref_in_anyof_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_ref_in_anyof_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_ref_in_anyof_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_ref_in_anyof_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_ref_in_anyof.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostRefInAnyofRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_ref_in_anyof_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_ref_in_anyof_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_ref_in_anyof_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_ref_in_anyof_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_ref_in_anyof_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_ref_in_anyof_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_ref_in_anyof_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ref_in_anyof_request_body/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ref_in_anyof_request_body/post.pyi deleted file mode 100644 index 61d129a8cd2..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ref_in_anyof_request_body/post.pyi +++ /dev/null @@ -1,293 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.ref_in_anyof import RefInAnyof - -# body param -SchemaForRequestBodyApplicationJson = RefInAnyof - - -request_body_ref_in_anyof = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_ref_in_anyof_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_ref_in_anyof_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_ref_in_anyof_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_ref_in_anyof_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_ref_in_anyof_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_ref_in_anyof.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostRefInAnyofRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_ref_in_anyof_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_ref_in_anyof_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_ref_in_anyof_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_ref_in_anyof_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_ref_in_anyof_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_ref_in_anyof_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_ref_in_anyof_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ref_in_anyof_request_body/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ref_in_anyof_request_body/post/__init__.py new file mode 100644 index 00000000000..bcfee9da8b8 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ref_in_anyof_request_body/post/__init__.py @@ -0,0 +1,291 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.ref_in_anyof import RefInAnyof + +from .. import path +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = RefInAnyof + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + +_status_code_to_response = { + '200': response_for_200.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _post_ref_in_anyof_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_ref_in_anyof_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_ref_in_anyof_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_ref_in_anyof_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_ref_in_anyof_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostRefInAnyofRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_ref_in_anyof_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_ref_in_anyof_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_ref_in_anyof_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_ref_in_anyof_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_ref_in_anyof_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_ref_in_anyof_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_ref_in_anyof_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ref_in_anyof_request_body/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ref_in_anyof_request_body/post/__init__.pyi new file mode 100644 index 00000000000..7d58ccbfb6e --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ref_in_anyof_request_body/post/__init__.pyi @@ -0,0 +1,286 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.ref_in_anyof import RefInAnyof + +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = RefInAnyof + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_ref_in_anyof_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_ref_in_anyof_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_ref_in_anyof_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_ref_in_anyof_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_ref_in_anyof_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostRefInAnyofRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_ref_in_anyof_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_ref_in_anyof_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_ref_in_anyof_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_ref_in_anyof_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_ref_in_anyof_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_ref_in_anyof_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_ref_in_anyof_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ref_in_anyof_request_body/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ref_in_anyof_request_body/post/response_for_200.py new file mode 100644 index 00000000000..ce057133be3 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ref_in_anyof_request_body/post/response_for_200.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ref_in_items_request_body/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ref_in_items_request_body/post.py deleted file mode 100644 index 3cf5261cef9..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ref_in_items_request_body/post.py +++ /dev/null @@ -1,298 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.ref_in_items import RefInItems - -from . import path - -# body param -SchemaForRequestBodyApplicationJson = RefInItems - - -request_body_ref_in_items = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) -_status_code_to_response = { - '200': _response_for_200, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _post_ref_in_items_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_ref_in_items_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_ref_in_items_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_ref_in_items_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_ref_in_items_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_ref_in_items.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostRefInItemsRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_ref_in_items_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_ref_in_items_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_ref_in_items_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_ref_in_items_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_ref_in_items_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_ref_in_items_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_ref_in_items_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ref_in_items_request_body/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ref_in_items_request_body/post.pyi deleted file mode 100644 index b41e000b84b..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ref_in_items_request_body/post.pyi +++ /dev/null @@ -1,293 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.ref_in_items import RefInItems - -# body param -SchemaForRequestBodyApplicationJson = RefInItems - - -request_body_ref_in_items = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_ref_in_items_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_ref_in_items_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_ref_in_items_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_ref_in_items_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_ref_in_items_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_ref_in_items.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostRefInItemsRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_ref_in_items_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_ref_in_items_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_ref_in_items_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_ref_in_items_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_ref_in_items_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_ref_in_items_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_ref_in_items_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ref_in_items_request_body/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ref_in_items_request_body/post/__init__.py new file mode 100644 index 00000000000..8a836762095 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ref_in_items_request_body/post/__init__.py @@ -0,0 +1,291 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.ref_in_items import RefInItems + +from .. import path +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = RefInItems + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + +_status_code_to_response = { + '200': response_for_200.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _post_ref_in_items_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_ref_in_items_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_ref_in_items_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_ref_in_items_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_ref_in_items_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostRefInItemsRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_ref_in_items_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_ref_in_items_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_ref_in_items_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_ref_in_items_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_ref_in_items_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_ref_in_items_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_ref_in_items_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ref_in_items_request_body/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ref_in_items_request_body/post/__init__.pyi new file mode 100644 index 00000000000..15bd83cc7b1 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ref_in_items_request_body/post/__init__.pyi @@ -0,0 +1,286 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.ref_in_items import RefInItems + +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = RefInItems + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_ref_in_items_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_ref_in_items_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_ref_in_items_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_ref_in_items_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_ref_in_items_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostRefInItemsRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_ref_in_items_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_ref_in_items_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_ref_in_items_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_ref_in_items_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_ref_in_items_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_ref_in_items_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_ref_in_items_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ref_in_items_request_body/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ref_in_items_request_body/post/response_for_200.py new file mode 100644 index 00000000000..ce057133be3 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ref_in_items_request_body/post/response_for_200.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ref_in_not_request_body/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ref_in_not_request_body/post.py deleted file mode 100644 index 16778e01bf1..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ref_in_not_request_body/post.py +++ /dev/null @@ -1,323 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.property_named_ref_that_is_not_a_reference import PropertyNamedRefThatIsNotAReference - -from . import path - -# body param - - -class SchemaForRequestBodyApplicationJson( - schemas.ComposedSchema, -): - - - class MetaOapg: - - @staticmethod - def not_schema() -> typing.Type['PropertyNamedRefThatIsNotAReference']: - return PropertyNamedRefThatIsNotAReference - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'SchemaForRequestBodyApplicationJson': - return super().__new__( - cls, - *args, - _configuration=_configuration, - **kwargs, - ) - - -request_body_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) -_status_code_to_response = { - '200': _response_for_200, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _post_ref_in_not_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_ref_in_not_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_ref_in_not_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_ref_in_not_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_ref_in_not_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostRefInNotRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_ref_in_not_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_ref_in_not_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_ref_in_not_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_ref_in_not_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_ref_in_not_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_ref_in_not_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_ref_in_not_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ref_in_not_request_body/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ref_in_not_request_body/post.pyi deleted file mode 100644 index 18e7489d24a..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ref_in_not_request_body/post.pyi +++ /dev/null @@ -1,318 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.property_named_ref_that_is_not_a_reference import PropertyNamedRefThatIsNotAReference - -# body param - - -class SchemaForRequestBodyApplicationJson( - schemas.ComposedSchema, -): - - - class MetaOapg: - - @staticmethod - def not_schema() -> typing.Type['PropertyNamedRefThatIsNotAReference']: - return PropertyNamedRefThatIsNotAReference - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'SchemaForRequestBodyApplicationJson': - return super().__new__( - cls, - *args, - _configuration=_configuration, - **kwargs, - ) - - -request_body_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_ref_in_not_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_ref_in_not_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_ref_in_not_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_ref_in_not_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_ref_in_not_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostRefInNotRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_ref_in_not_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_ref_in_not_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_ref_in_not_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_ref_in_not_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_ref_in_not_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_ref_in_not_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_ref_in_not_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ref_in_not_request_body/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ref_in_not_request_body/post/__init__.py new file mode 100644 index 00000000000..cd5d4c5738a --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ref_in_not_request_body/post/__init__.py @@ -0,0 +1,291 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.ref_in_not import RefInNot + +from .. import path +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = RefInNot + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + +_status_code_to_response = { + '200': response_for_200.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _post_ref_in_not_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_ref_in_not_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_ref_in_not_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_ref_in_not_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_ref_in_not_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostRefInNotRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_ref_in_not_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_ref_in_not_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_ref_in_not_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_ref_in_not_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_ref_in_not_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_ref_in_not_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_ref_in_not_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ref_in_not_request_body/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ref_in_not_request_body/post/__init__.pyi new file mode 100644 index 00000000000..2d15d763b4d --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ref_in_not_request_body/post/__init__.pyi @@ -0,0 +1,286 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.ref_in_not import RefInNot + +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = RefInNot + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_ref_in_not_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_ref_in_not_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_ref_in_not_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_ref_in_not_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_ref_in_not_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostRefInNotRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_ref_in_not_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_ref_in_not_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_ref_in_not_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_ref_in_not_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_ref_in_not_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_ref_in_not_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_ref_in_not_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ref_in_not_request_body/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ref_in_not_request_body/post/response_for_200.py new file mode 100644 index 00000000000..ce057133be3 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ref_in_not_request_body/post/response_for_200.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ref_in_oneof_request_body/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ref_in_oneof_request_body/post.py deleted file mode 100644 index f1dc48460c4..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ref_in_oneof_request_body/post.py +++ /dev/null @@ -1,298 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.ref_in_oneof import RefInOneof - -from . import path - -# body param -SchemaForRequestBodyApplicationJson = RefInOneof - - -request_body_ref_in_oneof = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) -_status_code_to_response = { - '200': _response_for_200, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _post_ref_in_oneof_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_ref_in_oneof_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_ref_in_oneof_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_ref_in_oneof_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_ref_in_oneof_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_ref_in_oneof.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostRefInOneofRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_ref_in_oneof_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_ref_in_oneof_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_ref_in_oneof_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_ref_in_oneof_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_ref_in_oneof_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_ref_in_oneof_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_ref_in_oneof_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ref_in_oneof_request_body/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ref_in_oneof_request_body/post.pyi deleted file mode 100644 index e3ca8f0a1bc..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ref_in_oneof_request_body/post.pyi +++ /dev/null @@ -1,293 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.ref_in_oneof import RefInOneof - -# body param -SchemaForRequestBodyApplicationJson = RefInOneof - - -request_body_ref_in_oneof = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_ref_in_oneof_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_ref_in_oneof_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_ref_in_oneof_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_ref_in_oneof_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_ref_in_oneof_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_ref_in_oneof.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostRefInOneofRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_ref_in_oneof_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_ref_in_oneof_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_ref_in_oneof_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_ref_in_oneof_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_ref_in_oneof_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_ref_in_oneof_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_ref_in_oneof_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ref_in_oneof_request_body/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ref_in_oneof_request_body/post/__init__.py new file mode 100644 index 00000000000..2d96a3d16fc --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ref_in_oneof_request_body/post/__init__.py @@ -0,0 +1,291 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.ref_in_oneof import RefInOneof + +from .. import path +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = RefInOneof + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + +_status_code_to_response = { + '200': response_for_200.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _post_ref_in_oneof_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_ref_in_oneof_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_ref_in_oneof_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_ref_in_oneof_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_ref_in_oneof_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostRefInOneofRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_ref_in_oneof_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_ref_in_oneof_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_ref_in_oneof_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_ref_in_oneof_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_ref_in_oneof_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_ref_in_oneof_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_ref_in_oneof_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ref_in_oneof_request_body/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ref_in_oneof_request_body/post/__init__.pyi new file mode 100644 index 00000000000..58783a33638 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ref_in_oneof_request_body/post/__init__.pyi @@ -0,0 +1,286 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.ref_in_oneof import RefInOneof + +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = RefInOneof + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_ref_in_oneof_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_ref_in_oneof_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_ref_in_oneof_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_ref_in_oneof_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_ref_in_oneof_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostRefInOneofRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_ref_in_oneof_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_ref_in_oneof_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_ref_in_oneof_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_ref_in_oneof_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_ref_in_oneof_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_ref_in_oneof_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_ref_in_oneof_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ref_in_oneof_request_body/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ref_in_oneof_request_body/post/response_for_200.py new file mode 100644 index 00000000000..ce057133be3 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ref_in_oneof_request_body/post/response_for_200.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ref_in_property_request_body/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ref_in_property_request_body/post.py deleted file mode 100644 index bc58c723b40..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ref_in_property_request_body/post.py +++ /dev/null @@ -1,298 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.ref_in_property import RefInProperty - -from . import path - -# body param -SchemaForRequestBodyApplicationJson = RefInProperty - - -request_body_ref_in_property = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) -_status_code_to_response = { - '200': _response_for_200, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _post_ref_in_property_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_ref_in_property_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_ref_in_property_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_ref_in_property_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_ref_in_property_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_ref_in_property.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostRefInPropertyRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_ref_in_property_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_ref_in_property_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_ref_in_property_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_ref_in_property_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_ref_in_property_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_ref_in_property_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_ref_in_property_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ref_in_property_request_body/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ref_in_property_request_body/post.pyi deleted file mode 100644 index 105713baa0e..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ref_in_property_request_body/post.pyi +++ /dev/null @@ -1,293 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.ref_in_property import RefInProperty - -# body param -SchemaForRequestBodyApplicationJson = RefInProperty - - -request_body_ref_in_property = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_ref_in_property_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_ref_in_property_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_ref_in_property_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_ref_in_property_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_ref_in_property_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_ref_in_property.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostRefInPropertyRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_ref_in_property_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_ref_in_property_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_ref_in_property_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_ref_in_property_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_ref_in_property_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_ref_in_property_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_ref_in_property_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ref_in_property_request_body/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ref_in_property_request_body/post/__init__.py new file mode 100644 index 00000000000..df62cedfa61 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ref_in_property_request_body/post/__init__.py @@ -0,0 +1,291 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.ref_in_property import RefInProperty + +from .. import path +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = RefInProperty + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + +_status_code_to_response = { + '200': response_for_200.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _post_ref_in_property_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_ref_in_property_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_ref_in_property_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_ref_in_property_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_ref_in_property_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostRefInPropertyRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_ref_in_property_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_ref_in_property_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_ref_in_property_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_ref_in_property_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_ref_in_property_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_ref_in_property_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_ref_in_property_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ref_in_property_request_body/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ref_in_property_request_body/post/__init__.pyi new file mode 100644 index 00000000000..8299e55bb35 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ref_in_property_request_body/post/__init__.pyi @@ -0,0 +1,286 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.ref_in_property import RefInProperty + +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = RefInProperty + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_ref_in_property_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_ref_in_property_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_ref_in_property_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_ref_in_property_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_ref_in_property_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostRefInPropertyRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_ref_in_property_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_ref_in_property_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_ref_in_property_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_ref_in_property_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_ref_in_property_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_ref_in_property_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_ref_in_property_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ref_in_property_request_body/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ref_in_property_request_body/post/response_for_200.py new file mode 100644 index 00000000000..ce057133be3 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_ref_in_property_request_body/post/response_for_200.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_required_default_validation_request_body/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_required_default_validation_request_body/post.py deleted file mode 100644 index b290ef0c3c6..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_required_default_validation_request_body/post.py +++ /dev/null @@ -1,298 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.required_default_validation import RequiredDefaultValidation - -from . import path - -# body param -SchemaForRequestBodyApplicationJson = RequiredDefaultValidation - - -request_body_required_default_validation = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) -_status_code_to_response = { - '200': _response_for_200, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _post_required_default_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_required_default_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_required_default_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_required_default_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_required_default_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_required_default_validation.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostRequiredDefaultValidationRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_required_default_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_required_default_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_required_default_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_required_default_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_required_default_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_required_default_validation_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_required_default_validation_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_required_default_validation_request_body/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_required_default_validation_request_body/post.pyi deleted file mode 100644 index 78d8bb0262a..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_required_default_validation_request_body/post.pyi +++ /dev/null @@ -1,293 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.required_default_validation import RequiredDefaultValidation - -# body param -SchemaForRequestBodyApplicationJson = RequiredDefaultValidation - - -request_body_required_default_validation = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_required_default_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_required_default_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_required_default_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_required_default_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_required_default_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_required_default_validation.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostRequiredDefaultValidationRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_required_default_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_required_default_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_required_default_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_required_default_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_required_default_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_required_default_validation_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_required_default_validation_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_required_default_validation_request_body/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_required_default_validation_request_body/post/__init__.py new file mode 100644 index 00000000000..db344116023 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_required_default_validation_request_body/post/__init__.py @@ -0,0 +1,291 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.required_default_validation import RequiredDefaultValidation + +from .. import path +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = RequiredDefaultValidation + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + +_status_code_to_response = { + '200': response_for_200.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _post_required_default_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_required_default_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_required_default_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_required_default_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_required_default_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostRequiredDefaultValidationRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_required_default_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_required_default_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_required_default_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_required_default_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_required_default_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_required_default_validation_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_required_default_validation_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_required_default_validation_request_body/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_required_default_validation_request_body/post/__init__.pyi new file mode 100644 index 00000000000..e345548d97d --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_required_default_validation_request_body/post/__init__.pyi @@ -0,0 +1,286 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.required_default_validation import RequiredDefaultValidation + +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = RequiredDefaultValidation + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_required_default_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_required_default_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_required_default_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_required_default_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_required_default_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostRequiredDefaultValidationRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_required_default_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_required_default_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_required_default_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_required_default_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_required_default_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_required_default_validation_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_required_default_validation_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_required_default_validation_request_body/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_required_default_validation_request_body/post/response_for_200.py new file mode 100644 index 00000000000..ce057133be3 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_required_default_validation_request_body/post/response_for_200.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_required_validation_request_body/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_required_validation_request_body/post.py deleted file mode 100644 index 31366c3fd8b..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_required_validation_request_body/post.py +++ /dev/null @@ -1,298 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.required_validation import RequiredValidation - -from . import path - -# body param -SchemaForRequestBodyApplicationJson = RequiredValidation - - -request_body_required_validation = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) -_status_code_to_response = { - '200': _response_for_200, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _post_required_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_required_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_required_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_required_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_required_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_required_validation.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostRequiredValidationRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_required_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_required_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_required_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_required_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_required_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_required_validation_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_required_validation_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_required_validation_request_body/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_required_validation_request_body/post.pyi deleted file mode 100644 index a0149cd11b1..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_required_validation_request_body/post.pyi +++ /dev/null @@ -1,293 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.required_validation import RequiredValidation - -# body param -SchemaForRequestBodyApplicationJson = RequiredValidation - - -request_body_required_validation = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_required_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_required_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_required_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_required_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_required_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_required_validation.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostRequiredValidationRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_required_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_required_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_required_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_required_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_required_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_required_validation_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_required_validation_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_required_validation_request_body/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_required_validation_request_body/post/__init__.py new file mode 100644 index 00000000000..06b398264a2 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_required_validation_request_body/post/__init__.py @@ -0,0 +1,291 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.required_validation import RequiredValidation + +from .. import path +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = RequiredValidation + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + +_status_code_to_response = { + '200': response_for_200.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _post_required_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_required_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_required_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_required_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_required_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostRequiredValidationRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_required_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_required_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_required_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_required_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_required_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_required_validation_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_required_validation_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_required_validation_request_body/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_required_validation_request_body/post/__init__.pyi new file mode 100644 index 00000000000..8a702c34be0 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_required_validation_request_body/post/__init__.pyi @@ -0,0 +1,286 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.required_validation import RequiredValidation + +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = RequiredValidation + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_required_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_required_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_required_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_required_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_required_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostRequiredValidationRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_required_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_required_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_required_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_required_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_required_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_required_validation_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_required_validation_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_required_validation_request_body/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_required_validation_request_body/post/response_for_200.py new file mode 100644 index 00000000000..ce057133be3 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_required_validation_request_body/post/response_for_200.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_required_with_empty_array_request_body/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_required_with_empty_array_request_body/post.py deleted file mode 100644 index 828d01bed20..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_required_with_empty_array_request_body/post.py +++ /dev/null @@ -1,298 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.required_with_empty_array import RequiredWithEmptyArray - -from . import path - -# body param -SchemaForRequestBodyApplicationJson = RequiredWithEmptyArray - - -request_body_required_with_empty_array = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) -_status_code_to_response = { - '200': _response_for_200, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _post_required_with_empty_array_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_required_with_empty_array_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_required_with_empty_array_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_required_with_empty_array_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_required_with_empty_array_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_required_with_empty_array.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostRequiredWithEmptyArrayRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_required_with_empty_array_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_required_with_empty_array_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_required_with_empty_array_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_required_with_empty_array_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_required_with_empty_array_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_required_with_empty_array_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_required_with_empty_array_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_required_with_empty_array_request_body/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_required_with_empty_array_request_body/post.pyi deleted file mode 100644 index 6490beb525f..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_required_with_empty_array_request_body/post.pyi +++ /dev/null @@ -1,293 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.required_with_empty_array import RequiredWithEmptyArray - -# body param -SchemaForRequestBodyApplicationJson = RequiredWithEmptyArray - - -request_body_required_with_empty_array = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_required_with_empty_array_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_required_with_empty_array_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_required_with_empty_array_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_required_with_empty_array_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_required_with_empty_array_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_required_with_empty_array.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostRequiredWithEmptyArrayRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_required_with_empty_array_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_required_with_empty_array_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_required_with_empty_array_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_required_with_empty_array_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_required_with_empty_array_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_required_with_empty_array_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_required_with_empty_array_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_required_with_empty_array_request_body/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_required_with_empty_array_request_body/post/__init__.py new file mode 100644 index 00000000000..ff28b4c053b --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_required_with_empty_array_request_body/post/__init__.py @@ -0,0 +1,291 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.required_with_empty_array import RequiredWithEmptyArray + +from .. import path +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = RequiredWithEmptyArray + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + +_status_code_to_response = { + '200': response_for_200.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _post_required_with_empty_array_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_required_with_empty_array_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_required_with_empty_array_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_required_with_empty_array_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_required_with_empty_array_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostRequiredWithEmptyArrayRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_required_with_empty_array_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_required_with_empty_array_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_required_with_empty_array_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_required_with_empty_array_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_required_with_empty_array_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_required_with_empty_array_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_required_with_empty_array_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_required_with_empty_array_request_body/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_required_with_empty_array_request_body/post/__init__.pyi new file mode 100644 index 00000000000..f5418a60cbb --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_required_with_empty_array_request_body/post/__init__.pyi @@ -0,0 +1,286 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.required_with_empty_array import RequiredWithEmptyArray + +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = RequiredWithEmptyArray + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_required_with_empty_array_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_required_with_empty_array_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_required_with_empty_array_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_required_with_empty_array_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_required_with_empty_array_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostRequiredWithEmptyArrayRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_required_with_empty_array_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_required_with_empty_array_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_required_with_empty_array_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_required_with_empty_array_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_required_with_empty_array_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_required_with_empty_array_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_required_with_empty_array_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_required_with_empty_array_request_body/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_required_with_empty_array_request_body/post/response_for_200.py new file mode 100644 index 00000000000..ce057133be3 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_required_with_empty_array_request_body/post/response_for_200.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_required_with_escaped_characters_request_body/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_required_with_escaped_characters_request_body/post.py deleted file mode 100644 index 5546b1c7222..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_required_with_escaped_characters_request_body/post.py +++ /dev/null @@ -1,326 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from . import path - -# body param - - -class SchemaForRequestBodyApplicationJson( - schemas.AnyTypeSchema, -): - - - class MetaOapg: - required = { - "foo\"bar", - "foo\nbar", - "foo\fbar", - "foo\tbar", - "foo\rbar", - "foo\\bar", - } - - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'SchemaForRequestBodyApplicationJson': - return super().__new__( - cls, - *args, - _configuration=_configuration, - **kwargs, - ) - - -request_body_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) -_status_code_to_response = { - '200': _response_for_200, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _post_required_with_escaped_characters_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_required_with_escaped_characters_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_required_with_escaped_characters_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_required_with_escaped_characters_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_required_with_escaped_characters_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostRequiredWithEscapedCharactersRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_required_with_escaped_characters_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_required_with_escaped_characters_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_required_with_escaped_characters_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_required_with_escaped_characters_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_required_with_escaped_characters_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_required_with_escaped_characters_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_required_with_escaped_characters_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_required_with_escaped_characters_request_body/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_required_with_escaped_characters_request_body/post.pyi deleted file mode 100644 index 4b9319331a9..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_required_with_escaped_characters_request_body/post.pyi +++ /dev/null @@ -1,321 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -# body param - - -class SchemaForRequestBodyApplicationJson( - schemas.AnyTypeSchema, -): - - - class MetaOapg: - required = { - "foo\"bar", - "foo\nbar", - "foo\fbar", - "foo\tbar", - "foo\rbar", - "foo\\bar", - } - - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'SchemaForRequestBodyApplicationJson': - return super().__new__( - cls, - *args, - _configuration=_configuration, - **kwargs, - ) - - -request_body_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_required_with_escaped_characters_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_required_with_escaped_characters_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_required_with_escaped_characters_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_required_with_escaped_characters_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_required_with_escaped_characters_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostRequiredWithEscapedCharactersRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_required_with_escaped_characters_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_required_with_escaped_characters_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_required_with_escaped_characters_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_required_with_escaped_characters_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_required_with_escaped_characters_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_required_with_escaped_characters_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_required_with_escaped_characters_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_required_with_escaped_characters_request_body/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_required_with_escaped_characters_request_body/post/__init__.py new file mode 100644 index 00000000000..169744086e0 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_required_with_escaped_characters_request_body/post/__init__.py @@ -0,0 +1,291 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.required_with_escaped_characters import RequiredWithEscapedCharacters + +from .. import path +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = RequiredWithEscapedCharacters + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + +_status_code_to_response = { + '200': response_for_200.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _post_required_with_escaped_characters_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_required_with_escaped_characters_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_required_with_escaped_characters_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_required_with_escaped_characters_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_required_with_escaped_characters_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostRequiredWithEscapedCharactersRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_required_with_escaped_characters_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_required_with_escaped_characters_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_required_with_escaped_characters_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_required_with_escaped_characters_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_required_with_escaped_characters_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_required_with_escaped_characters_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_required_with_escaped_characters_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_required_with_escaped_characters_request_body/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_required_with_escaped_characters_request_body/post/__init__.pyi new file mode 100644 index 00000000000..603c449e446 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_required_with_escaped_characters_request_body/post/__init__.pyi @@ -0,0 +1,286 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.required_with_escaped_characters import RequiredWithEscapedCharacters + +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = RequiredWithEscapedCharacters + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_required_with_escaped_characters_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_required_with_escaped_characters_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_required_with_escaped_characters_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_required_with_escaped_characters_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_required_with_escaped_characters_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostRequiredWithEscapedCharactersRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_required_with_escaped_characters_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_required_with_escaped_characters_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_required_with_escaped_characters_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_required_with_escaped_characters_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_required_with_escaped_characters_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_required_with_escaped_characters_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_required_with_escaped_characters_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_required_with_escaped_characters_request_body/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_required_with_escaped_characters_request_body/post/response_for_200.py new file mode 100644 index 00000000000..ce057133be3 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_required_with_escaped_characters_request_body/post/response_for_200.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_simple_enum_validation_request_body/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_simple_enum_validation_request_body/post.py deleted file mode 100644 index 48ce45ab21c..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_simple_enum_validation_request_body/post.py +++ /dev/null @@ -1,298 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.simple_enum_validation import SimpleEnumValidation - -from . import path - -# body param -SchemaForRequestBodyApplicationJson = SimpleEnumValidation - - -request_body_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) -_status_code_to_response = { - '200': _response_for_200, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _post_simple_enum_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_simple_enum_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_simple_enum_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_simple_enum_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_simple_enum_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostSimpleEnumValidationRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_simple_enum_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_simple_enum_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_simple_enum_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_simple_enum_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_simple_enum_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_simple_enum_validation_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_simple_enum_validation_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_simple_enum_validation_request_body/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_simple_enum_validation_request_body/post.pyi deleted file mode 100644 index b0ba5e5753f..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_simple_enum_validation_request_body/post.pyi +++ /dev/null @@ -1,293 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.simple_enum_validation import SimpleEnumValidation - -# body param -SchemaForRequestBodyApplicationJson = SimpleEnumValidation - - -request_body_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_simple_enum_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_simple_enum_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_simple_enum_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_simple_enum_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_simple_enum_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostSimpleEnumValidationRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_simple_enum_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_simple_enum_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_simple_enum_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_simple_enum_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_simple_enum_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_simple_enum_validation_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_simple_enum_validation_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_simple_enum_validation_request_body/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_simple_enum_validation_request_body/post/__init__.py new file mode 100644 index 00000000000..77924b9fd2c --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_simple_enum_validation_request_body/post/__init__.py @@ -0,0 +1,291 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.simple_enum_validation import SimpleEnumValidation + +from .. import path +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = SimpleEnumValidation + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + +_status_code_to_response = { + '200': response_for_200.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _post_simple_enum_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_simple_enum_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_simple_enum_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_simple_enum_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_simple_enum_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostSimpleEnumValidationRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_simple_enum_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_simple_enum_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_simple_enum_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_simple_enum_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_simple_enum_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_simple_enum_validation_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_simple_enum_validation_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_simple_enum_validation_request_body/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_simple_enum_validation_request_body/post/__init__.pyi new file mode 100644 index 00000000000..4e492fb4de4 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_simple_enum_validation_request_body/post/__init__.pyi @@ -0,0 +1,286 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.simple_enum_validation import SimpleEnumValidation + +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = SimpleEnumValidation + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_simple_enum_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_simple_enum_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_simple_enum_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_simple_enum_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_simple_enum_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostSimpleEnumValidationRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_simple_enum_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_simple_enum_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_simple_enum_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_simple_enum_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_simple_enum_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_simple_enum_validation_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_simple_enum_validation_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_simple_enum_validation_request_body/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_simple_enum_validation_request_body/post/response_for_200.py new file mode 100644 index 00000000000..ce057133be3 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_simple_enum_validation_request_body/post/response_for_200.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_string_type_matches_strings_request_body/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_string_type_matches_strings_request_body/post.py deleted file mode 100644 index 6db3472e65c..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_string_type_matches_strings_request_body/post.py +++ /dev/null @@ -1,296 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from . import path - -# body param -SchemaForRequestBodyApplicationJson = schemas.StrSchema - - -request_body_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) -_status_code_to_response = { - '200': _response_for_200, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _post_string_type_matches_strings_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,str, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_string_type_matches_strings_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,str, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_string_type_matches_strings_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,str, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_string_type_matches_strings_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,str, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_string_type_matches_strings_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,str, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostStringTypeMatchesStringsRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_string_type_matches_strings_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,str, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_string_type_matches_strings_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,str, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_string_type_matches_strings_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,str, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_string_type_matches_strings_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,str, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_string_type_matches_strings_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,str, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_string_type_matches_strings_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,str, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,str, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,str, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,str, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,str, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_string_type_matches_strings_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_string_type_matches_strings_request_body/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_string_type_matches_strings_request_body/post.pyi deleted file mode 100644 index 241d59964c4..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_string_type_matches_strings_request_body/post.pyi +++ /dev/null @@ -1,291 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -# body param -SchemaForRequestBodyApplicationJson = schemas.StrSchema - - -request_body_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_string_type_matches_strings_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,str, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_string_type_matches_strings_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,str, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_string_type_matches_strings_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,str, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_string_type_matches_strings_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,str, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_string_type_matches_strings_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,str, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostStringTypeMatchesStringsRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_string_type_matches_strings_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,str, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_string_type_matches_strings_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,str, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_string_type_matches_strings_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,str, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_string_type_matches_strings_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,str, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_string_type_matches_strings_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,str, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_string_type_matches_strings_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,str, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,str, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,str, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,str, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,str, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_string_type_matches_strings_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_string_type_matches_strings_request_body/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_string_type_matches_strings_request_body/post/__init__.py new file mode 100644 index 00000000000..2d2a78c6f9f --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_string_type_matches_strings_request_body/post/__init__.py @@ -0,0 +1,291 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.string_type_matches_strings import StringTypeMatchesStrings + +from .. import path +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = StringTypeMatchesStrings + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + +_status_code_to_response = { + '200': response_for_200.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _post_string_type_matches_strings_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_string_type_matches_strings_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_string_type_matches_strings_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_string_type_matches_strings_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_string_type_matches_strings_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostStringTypeMatchesStringsRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_string_type_matches_strings_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_string_type_matches_strings_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_string_type_matches_strings_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_string_type_matches_strings_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_string_type_matches_strings_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_string_type_matches_strings_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_string_type_matches_strings_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_string_type_matches_strings_request_body/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_string_type_matches_strings_request_body/post/__init__.pyi new file mode 100644 index 00000000000..fd267337131 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_string_type_matches_strings_request_body/post/__init__.pyi @@ -0,0 +1,286 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.string_type_matches_strings import StringTypeMatchesStrings + +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = StringTypeMatchesStrings + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_string_type_matches_strings_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_string_type_matches_strings_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_string_type_matches_strings_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_string_type_matches_strings_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_string_type_matches_strings_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostStringTypeMatchesStringsRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_string_type_matches_strings_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_string_type_matches_strings_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_string_type_matches_strings_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_string_type_matches_strings_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_string_type_matches_strings_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_string_type_matches_strings_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_string_type_matches_strings_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_string_type_matches_strings_request_body/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_string_type_matches_strings_request_body/post/response_for_200.py new file mode 100644 index 00000000000..ce057133be3 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_string_type_matches_strings_request_body/post/response_for_200.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_request_body/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_request_body/post.py deleted file mode 100644 index baaf238e68f..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_request_body/post.py +++ /dev/null @@ -1,298 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.the_default_keyword_does_not_do_anything_if_the_property_is_missing import TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing - -from . import path - -# body param -SchemaForRequestBodyApplicationJson = TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing - - -request_body_the_default_keyword_does_not_do_anything_if_the_property_is_missing = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) -_status_code_to_response = { - '200': _response_for_200, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_the_default_keyword_does_not_do_anything_if_the_property_is_missing.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostTheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_request_body/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_request_body/post.pyi deleted file mode 100644 index 50cbe145335..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_request_body/post.pyi +++ /dev/null @@ -1,293 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.the_default_keyword_does_not_do_anything_if_the_property_is_missing import TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing - -# body param -SchemaForRequestBodyApplicationJson = TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing - - -request_body_the_default_keyword_does_not_do_anything_if_the_property_is_missing = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_the_default_keyword_does_not_do_anything_if_the_property_is_missing.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostTheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_request_body/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_request_body/post/__init__.py new file mode 100644 index 00000000000..9924b6172d4 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_request_body/post/__init__.py @@ -0,0 +1,291 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.the_default_keyword_does_not_do_anything_if_the_property_is_missing import TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing + +from .. import path +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + +_status_code_to_response = { + '200': response_for_200.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostTheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_request_body/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_request_body/post/__init__.pyi new file mode 100644 index 00000000000..cd5f90d9918 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_request_body/post/__init__.pyi @@ -0,0 +1,286 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.the_default_keyword_does_not_do_anything_if_the_property_is_missing import TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing + +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostTheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_request_body/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_request_body/post/response_for_200.py new file mode 100644 index 00000000000..ce057133be3 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_request_body/post/response_for_200.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_uniqueitems_false_validation_request_body/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_uniqueitems_false_validation_request_body/post.py deleted file mode 100644 index 2d9e8e8482d..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_uniqueitems_false_validation_request_body/post.py +++ /dev/null @@ -1,298 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.uniqueitems_false_validation import UniqueitemsFalseValidation - -from . import path - -# body param -SchemaForRequestBodyApplicationJson = UniqueitemsFalseValidation - - -request_body_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) -_status_code_to_response = { - '200': _response_for_200, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _post_uniqueitems_false_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_uniqueitems_false_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_uniqueitems_false_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_uniqueitems_false_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_uniqueitems_false_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostUniqueitemsFalseValidationRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_uniqueitems_false_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_uniqueitems_false_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_uniqueitems_false_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_uniqueitems_false_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_uniqueitems_false_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_uniqueitems_false_validation_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_uniqueitems_false_validation_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_uniqueitems_false_validation_request_body/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_uniqueitems_false_validation_request_body/post.pyi deleted file mode 100644 index f1cb3b3ce33..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_uniqueitems_false_validation_request_body/post.pyi +++ /dev/null @@ -1,293 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.uniqueitems_false_validation import UniqueitemsFalseValidation - -# body param -SchemaForRequestBodyApplicationJson = UniqueitemsFalseValidation - - -request_body_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_uniqueitems_false_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_uniqueitems_false_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_uniqueitems_false_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_uniqueitems_false_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_uniqueitems_false_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostUniqueitemsFalseValidationRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_uniqueitems_false_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_uniqueitems_false_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_uniqueitems_false_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_uniqueitems_false_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_uniqueitems_false_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_uniqueitems_false_validation_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_uniqueitems_false_validation_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_uniqueitems_false_validation_request_body/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_uniqueitems_false_validation_request_body/post/__init__.py new file mode 100644 index 00000000000..e4295f3f449 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_uniqueitems_false_validation_request_body/post/__init__.py @@ -0,0 +1,291 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.uniqueitems_false_validation import UniqueitemsFalseValidation + +from .. import path +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = UniqueitemsFalseValidation + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + +_status_code_to_response = { + '200': response_for_200.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _post_uniqueitems_false_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_uniqueitems_false_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_uniqueitems_false_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_uniqueitems_false_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_uniqueitems_false_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostUniqueitemsFalseValidationRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_uniqueitems_false_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_uniqueitems_false_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_uniqueitems_false_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_uniqueitems_false_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_uniqueitems_false_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_uniqueitems_false_validation_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_uniqueitems_false_validation_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_uniqueitems_false_validation_request_body/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_uniqueitems_false_validation_request_body/post/__init__.pyi new file mode 100644 index 00000000000..e5fc9ac652c --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_uniqueitems_false_validation_request_body/post/__init__.pyi @@ -0,0 +1,286 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.uniqueitems_false_validation import UniqueitemsFalseValidation + +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = UniqueitemsFalseValidation + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_uniqueitems_false_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_uniqueitems_false_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_uniqueitems_false_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_uniqueitems_false_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_uniqueitems_false_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostUniqueitemsFalseValidationRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_uniqueitems_false_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_uniqueitems_false_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_uniqueitems_false_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_uniqueitems_false_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_uniqueitems_false_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_uniqueitems_false_validation_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_uniqueitems_false_validation_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_uniqueitems_false_validation_request_body/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_uniqueitems_false_validation_request_body/post/response_for_200.py new file mode 100644 index 00000000000..ce057133be3 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_uniqueitems_false_validation_request_body/post/response_for_200.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_uniqueitems_validation_request_body/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_uniqueitems_validation_request_body/post.py deleted file mode 100644 index 75738c89064..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_uniqueitems_validation_request_body/post.py +++ /dev/null @@ -1,298 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.uniqueitems_validation import UniqueitemsValidation - -from . import path - -# body param -SchemaForRequestBodyApplicationJson = UniqueitemsValidation - - -request_body_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) -_status_code_to_response = { - '200': _response_for_200, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _post_uniqueitems_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_uniqueitems_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_uniqueitems_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_uniqueitems_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_uniqueitems_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostUniqueitemsValidationRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_uniqueitems_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_uniqueitems_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_uniqueitems_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_uniqueitems_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_uniqueitems_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_uniqueitems_validation_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_uniqueitems_validation_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_uniqueitems_validation_request_body/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_uniqueitems_validation_request_body/post.pyi deleted file mode 100644 index 471f7aa06b0..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_uniqueitems_validation_request_body/post.pyi +++ /dev/null @@ -1,293 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.uniqueitems_validation import UniqueitemsValidation - -# body param -SchemaForRequestBodyApplicationJson = UniqueitemsValidation - - -request_body_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_uniqueitems_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_uniqueitems_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_uniqueitems_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_uniqueitems_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_uniqueitems_validation_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostUniqueitemsValidationRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_uniqueitems_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_uniqueitems_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_uniqueitems_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_uniqueitems_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_uniqueitems_validation_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_uniqueitems_validation_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_uniqueitems_validation_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_uniqueitems_validation_request_body/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_uniqueitems_validation_request_body/post/__init__.py new file mode 100644 index 00000000000..9d00119ab17 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_uniqueitems_validation_request_body/post/__init__.py @@ -0,0 +1,291 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.uniqueitems_validation import UniqueitemsValidation + +from .. import path +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = UniqueitemsValidation + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + +_status_code_to_response = { + '200': response_for_200.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _post_uniqueitems_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_uniqueitems_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_uniqueitems_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_uniqueitems_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_uniqueitems_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostUniqueitemsValidationRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_uniqueitems_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_uniqueitems_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_uniqueitems_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_uniqueitems_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_uniqueitems_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_uniqueitems_validation_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_uniqueitems_validation_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_uniqueitems_validation_request_body/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_uniqueitems_validation_request_body/post/__init__.pyi new file mode 100644 index 00000000000..3ca3c9d4e23 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_uniqueitems_validation_request_body/post/__init__.pyi @@ -0,0 +1,286 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.uniqueitems_validation import UniqueitemsValidation + +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = UniqueitemsValidation + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_uniqueitems_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_uniqueitems_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_uniqueitems_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_uniqueitems_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_uniqueitems_validation_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostUniqueitemsValidationRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_uniqueitems_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_uniqueitems_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_uniqueitems_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_uniqueitems_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_uniqueitems_validation_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_uniqueitems_validation_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_uniqueitems_validation_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_uniqueitems_validation_request_body/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_uniqueitems_validation_request_body/post/response_for_200.py new file mode 100644 index 00000000000..ce057133be3 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_uniqueitems_validation_request_body/post/response_for_200.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_uri_format_request_body/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_uri_format_request_body/post.py deleted file mode 100644 index 01f1e01a381..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_uri_format_request_body/post.py +++ /dev/null @@ -1,318 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from . import path - -# body param - - -class SchemaForRequestBodyApplicationJson( - schemas.AnyTypeSchema, -): - - - class MetaOapg: - format = 'uri' - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'SchemaForRequestBodyApplicationJson': - return super().__new__( - cls, - *args, - _configuration=_configuration, - **kwargs, - ) - - -request_body_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) -_status_code_to_response = { - '200': _response_for_200, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _post_uri_format_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_uri_format_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_uri_format_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_uri_format_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_uri_format_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostUriFormatRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_uri_format_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_uri_format_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_uri_format_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_uri_format_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_uri_format_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_uri_format_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_uri_format_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_uri_format_request_body/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_uri_format_request_body/post.pyi deleted file mode 100644 index bd57141d4ff..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_uri_format_request_body/post.pyi +++ /dev/null @@ -1,313 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -# body param - - -class SchemaForRequestBodyApplicationJson( - schemas.AnyTypeSchema, -): - - - class MetaOapg: - format = 'uri' - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'SchemaForRequestBodyApplicationJson': - return super().__new__( - cls, - *args, - _configuration=_configuration, - **kwargs, - ) - - -request_body_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_uri_format_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_uri_format_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_uri_format_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_uri_format_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_uri_format_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostUriFormatRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_uri_format_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_uri_format_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_uri_format_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_uri_format_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_uri_format_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_uri_format_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_uri_format_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_uri_format_request_body/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_uri_format_request_body/post/__init__.py new file mode 100644 index 00000000000..093f62594bb --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_uri_format_request_body/post/__init__.py @@ -0,0 +1,291 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.uri_format import UriFormat + +from .. import path +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = UriFormat + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + +_status_code_to_response = { + '200': response_for_200.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _post_uri_format_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_uri_format_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_uri_format_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_uri_format_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_uri_format_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostUriFormatRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_uri_format_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_uri_format_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_uri_format_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_uri_format_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_uri_format_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_uri_format_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_uri_format_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_uri_format_request_body/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_uri_format_request_body/post/__init__.pyi new file mode 100644 index 00000000000..e9b00d89de6 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_uri_format_request_body/post/__init__.pyi @@ -0,0 +1,286 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.uri_format import UriFormat + +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = UriFormat + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_uri_format_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_uri_format_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_uri_format_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_uri_format_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_uri_format_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostUriFormatRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_uri_format_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_uri_format_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_uri_format_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_uri_format_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_uri_format_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_uri_format_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_uri_format_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_uri_format_request_body/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_uri_format_request_body/post/response_for_200.py new file mode 100644 index 00000000000..ce057133be3 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_uri_format_request_body/post/response_for_200.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_uri_reference_format_request_body/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_uri_reference_format_request_body/post.py deleted file mode 100644 index ac7b2ca12ed..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_uri_reference_format_request_body/post.py +++ /dev/null @@ -1,318 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from . import path - -# body param - - -class SchemaForRequestBodyApplicationJson( - schemas.AnyTypeSchema, -): - - - class MetaOapg: - format = 'uri-reference' - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'SchemaForRequestBodyApplicationJson': - return super().__new__( - cls, - *args, - _configuration=_configuration, - **kwargs, - ) - - -request_body_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) -_status_code_to_response = { - '200': _response_for_200, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _post_uri_reference_format_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_uri_reference_format_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_uri_reference_format_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_uri_reference_format_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_uri_reference_format_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostUriReferenceFormatRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_uri_reference_format_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_uri_reference_format_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_uri_reference_format_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_uri_reference_format_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_uri_reference_format_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_uri_reference_format_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_uri_reference_format_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_uri_reference_format_request_body/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_uri_reference_format_request_body/post.pyi deleted file mode 100644 index 32efe64f381..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_uri_reference_format_request_body/post.pyi +++ /dev/null @@ -1,313 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -# body param - - -class SchemaForRequestBodyApplicationJson( - schemas.AnyTypeSchema, -): - - - class MetaOapg: - format = 'uri-reference' - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'SchemaForRequestBodyApplicationJson': - return super().__new__( - cls, - *args, - _configuration=_configuration, - **kwargs, - ) - - -request_body_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_uri_reference_format_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_uri_reference_format_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_uri_reference_format_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_uri_reference_format_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_uri_reference_format_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostUriReferenceFormatRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_uri_reference_format_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_uri_reference_format_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_uri_reference_format_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_uri_reference_format_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_uri_reference_format_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_uri_reference_format_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_uri_reference_format_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_uri_reference_format_request_body/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_uri_reference_format_request_body/post/__init__.py new file mode 100644 index 00000000000..e3ccb890410 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_uri_reference_format_request_body/post/__init__.py @@ -0,0 +1,291 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.uri_reference_format import UriReferenceFormat + +from .. import path +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = UriReferenceFormat + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + +_status_code_to_response = { + '200': response_for_200.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _post_uri_reference_format_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_uri_reference_format_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_uri_reference_format_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_uri_reference_format_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_uri_reference_format_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostUriReferenceFormatRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_uri_reference_format_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_uri_reference_format_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_uri_reference_format_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_uri_reference_format_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_uri_reference_format_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_uri_reference_format_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_uri_reference_format_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_uri_reference_format_request_body/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_uri_reference_format_request_body/post/__init__.pyi new file mode 100644 index 00000000000..78d5c544193 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_uri_reference_format_request_body/post/__init__.pyi @@ -0,0 +1,286 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.uri_reference_format import UriReferenceFormat + +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = UriReferenceFormat + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_uri_reference_format_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_uri_reference_format_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_uri_reference_format_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_uri_reference_format_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_uri_reference_format_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostUriReferenceFormatRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_uri_reference_format_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_uri_reference_format_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_uri_reference_format_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_uri_reference_format_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_uri_reference_format_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_uri_reference_format_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_uri_reference_format_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_uri_reference_format_request_body/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_uri_reference_format_request_body/post/response_for_200.py new file mode 100644 index 00000000000..ce057133be3 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_uri_reference_format_request_body/post/response_for_200.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_uri_template_format_request_body/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_uri_template_format_request_body/post.py deleted file mode 100644 index ecbb8a59927..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_uri_template_format_request_body/post.py +++ /dev/null @@ -1,318 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from . import path - -# body param - - -class SchemaForRequestBodyApplicationJson( - schemas.AnyTypeSchema, -): - - - class MetaOapg: - format = 'uri-template' - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'SchemaForRequestBodyApplicationJson': - return super().__new__( - cls, - *args, - _configuration=_configuration, - **kwargs, - ) - - -request_body_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) -_status_code_to_response = { - '200': _response_for_200, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _post_uri_template_format_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_uri_template_format_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_uri_template_format_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_uri_template_format_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_uri_template_format_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostUriTemplateFormatRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_uri_template_format_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_uri_template_format_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_uri_template_format_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_uri_template_format_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_uri_template_format_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_uri_template_format_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_uri_template_format_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_uri_template_format_request_body/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_uri_template_format_request_body/post.pyi deleted file mode 100644 index c11c280ca84..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_uri_template_format_request_body/post.pyi +++ /dev/null @@ -1,313 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -# body param - - -class SchemaForRequestBodyApplicationJson( - schemas.AnyTypeSchema, -): - - - class MetaOapg: - format = 'uri-template' - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'SchemaForRequestBodyApplicationJson': - return super().__new__( - cls, - *args, - _configuration=_configuration, - **kwargs, - ) - - -request_body_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_uri_template_format_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_uri_template_format_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_uri_template_format_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_uri_template_format_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_uri_template_format_request_body_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostUriTemplateFormatRequestBody(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_uri_template_format_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_uri_template_format_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_uri_template_format_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_uri_template_format_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_uri_template_format_request_body( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_uri_template_format_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_uri_template_format_request_body_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_uri_template_format_request_body/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_uri_template_format_request_body/post/__init__.py new file mode 100644 index 00000000000..0d6cc5b8c0d --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_uri_template_format_request_body/post/__init__.py @@ -0,0 +1,291 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.uri_template_format import UriTemplateFormat + +from .. import path +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = UriTemplateFormat + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + +_status_code_to_response = { + '200': response_for_200.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _post_uri_template_format_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_uri_template_format_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_uri_template_format_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_uri_template_format_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_uri_template_format_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostUriTemplateFormatRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_uri_template_format_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_uri_template_format_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_uri_template_format_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_uri_template_format_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_uri_template_format_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_uri_template_format_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_uri_template_format_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_uri_template_format_request_body/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_uri_template_format_request_body/post/__init__.pyi new file mode 100644 index 00000000000..7902aced000 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_uri_template_format_request_body/post/__init__.pyi @@ -0,0 +1,286 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.uri_template_format import UriTemplateFormat + +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = UriTemplateFormat + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_uri_template_format_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_uri_template_format_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_uri_template_format_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_uri_template_format_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_uri_template_format_request_body_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostUriTemplateFormatRequestBody(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_uri_template_format_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_uri_template_format_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_uri_template_format_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_uri_template_format_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_uri_template_format_request_body( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_uri_template_format_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_uri_template_format_request_body_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_uri_template_format_request_body/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_uri_template_format_request_body/post/response_for_200.py new file mode 100644 index 00000000000..ce057133be3 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_uri_template_format_request_body/post/response_for_200.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_additionalproperties_allows_a_schema_which_should_validate_response_body_for_content_types/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_additionalproperties_allows_a_schema_which_should_validate_response_body_for_content_types/post.py deleted file mode 100644 index 69c763dcab0..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_additionalproperties_allows_a_schema_which_should_validate_response_body_for_content_types/post.py +++ /dev/null @@ -1,234 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.additionalproperties_allows_a_schema_which_should_validate import AdditionalpropertiesAllowsASchemaWhichShouldValidate - -from . import path - -SchemaFor200ResponseBodyApplicationJson = AdditionalpropertiesAllowsASchemaWhichShouldValidate - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_status_code_to_response = { - '200': _response_for_200, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_additionalproperties_allows_a_schema_which_should_validate_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_additionalproperties_allows_a_schema_which_should_validate_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_additionalproperties_allows_a_schema_which_should_validate_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_additionalproperties_allows_a_schema_which_should_validate_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostAdditionalpropertiesAllowsASchemaWhichShouldValidateResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_additionalproperties_allows_a_schema_which_should_validate_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_additionalproperties_allows_a_schema_which_should_validate_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_additionalproperties_allows_a_schema_which_should_validate_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_additionalproperties_allows_a_schema_which_should_validate_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_additionalproperties_allows_a_schema_which_should_validate_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_additionalproperties_allows_a_schema_which_should_validate_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_additionalproperties_allows_a_schema_which_should_validate_response_body_for_content_types/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_additionalproperties_allows_a_schema_which_should_validate_response_body_for_content_types/post.pyi deleted file mode 100644 index 2a5e71e5e09..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_additionalproperties_allows_a_schema_which_should_validate_response_body_for_content_types/post.pyi +++ /dev/null @@ -1,229 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.additionalproperties_allows_a_schema_which_should_validate import AdditionalpropertiesAllowsASchemaWhichShouldValidate - -SchemaFor200ResponseBodyApplicationJson = AdditionalpropertiesAllowsASchemaWhichShouldValidate - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_additionalproperties_allows_a_schema_which_should_validate_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_additionalproperties_allows_a_schema_which_should_validate_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_additionalproperties_allows_a_schema_which_should_validate_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_additionalproperties_allows_a_schema_which_should_validate_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostAdditionalpropertiesAllowsASchemaWhichShouldValidateResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_additionalproperties_allows_a_schema_which_should_validate_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_additionalproperties_allows_a_schema_which_should_validate_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_additionalproperties_allows_a_schema_which_should_validate_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_additionalproperties_allows_a_schema_which_should_validate_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_additionalproperties_allows_a_schema_which_should_validate_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_additionalproperties_allows_a_schema_which_should_validate_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_additionalproperties_allows_a_schema_which_should_validate_response_body_for_content_types/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_additionalproperties_allows_a_schema_which_should_validate_response_body_for_content_types/post/__init__.py new file mode 100644 index 00000000000..80463b6c572 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_additionalproperties_allows_a_schema_which_should_validate_response_body_for_content_types/post/__init__.py @@ -0,0 +1,215 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 + + +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_additionalproperties_allows_a_schema_which_should_validate_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_additionalproperties_allows_a_schema_which_should_validate_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_additionalproperties_allows_a_schema_which_should_validate_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_additionalproperties_allows_a_schema_which_should_validate_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostAdditionalpropertiesAllowsASchemaWhichShouldValidateResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_additionalproperties_allows_a_schema_which_should_validate_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_additionalproperties_allows_a_schema_which_should_validate_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_additionalproperties_allows_a_schema_which_should_validate_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_additionalproperties_allows_a_schema_which_should_validate_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_additionalproperties_allows_a_schema_which_should_validate_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_additionalproperties_allows_a_schema_which_should_validate_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_additionalproperties_allows_a_schema_which_should_validate_response_body_for_content_types/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_additionalproperties_allows_a_schema_which_should_validate_response_body_for_content_types/post/__init__.pyi new file mode 100644 index 00000000000..9d4ff122b65 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_additionalproperties_allows_a_schema_which_should_validate_response_body_for_content_types/post/__init__.pyi @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from . import response_for_200 + +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_additionalproperties_allows_a_schema_which_should_validate_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_additionalproperties_allows_a_schema_which_should_validate_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_additionalproperties_allows_a_schema_which_should_validate_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_additionalproperties_allows_a_schema_which_should_validate_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostAdditionalpropertiesAllowsASchemaWhichShouldValidateResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_additionalproperties_allows_a_schema_which_should_validate_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_additionalproperties_allows_a_schema_which_should_validate_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_additionalproperties_allows_a_schema_which_should_validate_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_additionalproperties_allows_a_schema_which_should_validate_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_additionalproperties_allows_a_schema_which_should_validate_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_additionalproperties_allows_a_schema_which_should_validate_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_additionalproperties_allows_a_schema_which_should_validate_response_body_for_content_types/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_additionalproperties_allows_a_schema_which_should_validate_response_body_for_content_types/post/response_for_200.py new file mode 100644 index 00000000000..51d6d023dd5 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_additionalproperties_allows_a_schema_which_should_validate_response_body_for_content_types/post/response_for_200.py @@ -0,0 +1,43 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.additionalproperties_allows_a_schema_which_should_validate import AdditionalpropertiesAllowsASchemaWhichShouldValidate + + +class BodySchemas: + # body schemas + application_json = AdditionalpropertiesAllowsASchemaWhichShouldValidate + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_additionalproperties_are_allowed_by_default_response_body_for_content_types/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_additionalproperties_are_allowed_by_default_response_body_for_content_types/post.py deleted file mode 100644 index 0ef020fde52..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_additionalproperties_are_allowed_by_default_response_body_for_content_types/post.py +++ /dev/null @@ -1,234 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.additionalproperties_are_allowed_by_default import AdditionalpropertiesAreAllowedByDefault - -from . import path - -SchemaFor200ResponseBodyApplicationJson = AdditionalpropertiesAreAllowedByDefault - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_status_code_to_response = { - '200': _response_for_200, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_additionalproperties_are_allowed_by_default_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_additionalproperties_are_allowed_by_default_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_additionalproperties_are_allowed_by_default_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_additionalproperties_are_allowed_by_default_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostAdditionalpropertiesAreAllowedByDefaultResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_additionalproperties_are_allowed_by_default_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_additionalproperties_are_allowed_by_default_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_additionalproperties_are_allowed_by_default_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_additionalproperties_are_allowed_by_default_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_additionalproperties_are_allowed_by_default_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_additionalproperties_are_allowed_by_default_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_additionalproperties_are_allowed_by_default_response_body_for_content_types/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_additionalproperties_are_allowed_by_default_response_body_for_content_types/post.pyi deleted file mode 100644 index 328985f0eed..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_additionalproperties_are_allowed_by_default_response_body_for_content_types/post.pyi +++ /dev/null @@ -1,229 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.additionalproperties_are_allowed_by_default import AdditionalpropertiesAreAllowedByDefault - -SchemaFor200ResponseBodyApplicationJson = AdditionalpropertiesAreAllowedByDefault - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_additionalproperties_are_allowed_by_default_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_additionalproperties_are_allowed_by_default_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_additionalproperties_are_allowed_by_default_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_additionalproperties_are_allowed_by_default_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostAdditionalpropertiesAreAllowedByDefaultResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_additionalproperties_are_allowed_by_default_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_additionalproperties_are_allowed_by_default_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_additionalproperties_are_allowed_by_default_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_additionalproperties_are_allowed_by_default_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_additionalproperties_are_allowed_by_default_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_additionalproperties_are_allowed_by_default_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_additionalproperties_are_allowed_by_default_response_body_for_content_types/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_additionalproperties_are_allowed_by_default_response_body_for_content_types/post/__init__.py new file mode 100644 index 00000000000..8971cc0666c --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_additionalproperties_are_allowed_by_default_response_body_for_content_types/post/__init__.py @@ -0,0 +1,215 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 + + +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_additionalproperties_are_allowed_by_default_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_additionalproperties_are_allowed_by_default_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_additionalproperties_are_allowed_by_default_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_additionalproperties_are_allowed_by_default_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostAdditionalpropertiesAreAllowedByDefaultResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_additionalproperties_are_allowed_by_default_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_additionalproperties_are_allowed_by_default_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_additionalproperties_are_allowed_by_default_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_additionalproperties_are_allowed_by_default_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_additionalproperties_are_allowed_by_default_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_additionalproperties_are_allowed_by_default_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_additionalproperties_are_allowed_by_default_response_body_for_content_types/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_additionalproperties_are_allowed_by_default_response_body_for_content_types/post/__init__.pyi new file mode 100644 index 00000000000..f6d93012190 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_additionalproperties_are_allowed_by_default_response_body_for_content_types/post/__init__.pyi @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from . import response_for_200 + +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_additionalproperties_are_allowed_by_default_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_additionalproperties_are_allowed_by_default_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_additionalproperties_are_allowed_by_default_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_additionalproperties_are_allowed_by_default_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostAdditionalpropertiesAreAllowedByDefaultResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_additionalproperties_are_allowed_by_default_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_additionalproperties_are_allowed_by_default_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_additionalproperties_are_allowed_by_default_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_additionalproperties_are_allowed_by_default_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_additionalproperties_are_allowed_by_default_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_additionalproperties_are_allowed_by_default_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_additionalproperties_are_allowed_by_default_response_body_for_content_types/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_additionalproperties_are_allowed_by_default_response_body_for_content_types/post/response_for_200.py new file mode 100644 index 00000000000..5623a826f7d --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_additionalproperties_are_allowed_by_default_response_body_for_content_types/post/response_for_200.py @@ -0,0 +1,43 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.additionalproperties_are_allowed_by_default import AdditionalpropertiesAreAllowedByDefault + + +class BodySchemas: + # body schemas + application_json = AdditionalpropertiesAreAllowedByDefault + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_additionalproperties_can_exist_by_itself_response_body_for_content_types/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_additionalproperties_can_exist_by_itself_response_body_for_content_types/post.py deleted file mode 100644 index 39b07dfedb0..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_additionalproperties_can_exist_by_itself_response_body_for_content_types/post.py +++ /dev/null @@ -1,234 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.additionalproperties_can_exist_by_itself import AdditionalpropertiesCanExistByItself - -from . import path - -SchemaFor200ResponseBodyApplicationJson = AdditionalpropertiesCanExistByItself - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_status_code_to_response = { - '200': _response_for_200, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_additionalproperties_can_exist_by_itself_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_additionalproperties_can_exist_by_itself_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_additionalproperties_can_exist_by_itself_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_additionalproperties_can_exist_by_itself_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostAdditionalpropertiesCanExistByItselfResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_additionalproperties_can_exist_by_itself_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_additionalproperties_can_exist_by_itself_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_additionalproperties_can_exist_by_itself_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_additionalproperties_can_exist_by_itself_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_additionalproperties_can_exist_by_itself_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_additionalproperties_can_exist_by_itself_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_additionalproperties_can_exist_by_itself_response_body_for_content_types/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_additionalproperties_can_exist_by_itself_response_body_for_content_types/post.pyi deleted file mode 100644 index 02d57121925..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_additionalproperties_can_exist_by_itself_response_body_for_content_types/post.pyi +++ /dev/null @@ -1,229 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.additionalproperties_can_exist_by_itself import AdditionalpropertiesCanExistByItself - -SchemaFor200ResponseBodyApplicationJson = AdditionalpropertiesCanExistByItself - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_additionalproperties_can_exist_by_itself_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_additionalproperties_can_exist_by_itself_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_additionalproperties_can_exist_by_itself_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_additionalproperties_can_exist_by_itself_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostAdditionalpropertiesCanExistByItselfResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_additionalproperties_can_exist_by_itself_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_additionalproperties_can_exist_by_itself_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_additionalproperties_can_exist_by_itself_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_additionalproperties_can_exist_by_itself_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_additionalproperties_can_exist_by_itself_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_additionalproperties_can_exist_by_itself_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_additionalproperties_can_exist_by_itself_response_body_for_content_types/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_additionalproperties_can_exist_by_itself_response_body_for_content_types/post/__init__.py new file mode 100644 index 00000000000..cd1ed4c3ef7 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_additionalproperties_can_exist_by_itself_response_body_for_content_types/post/__init__.py @@ -0,0 +1,215 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 + + +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_additionalproperties_can_exist_by_itself_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_additionalproperties_can_exist_by_itself_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_additionalproperties_can_exist_by_itself_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_additionalproperties_can_exist_by_itself_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostAdditionalpropertiesCanExistByItselfResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_additionalproperties_can_exist_by_itself_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_additionalproperties_can_exist_by_itself_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_additionalproperties_can_exist_by_itself_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_additionalproperties_can_exist_by_itself_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_additionalproperties_can_exist_by_itself_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_additionalproperties_can_exist_by_itself_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_additionalproperties_can_exist_by_itself_response_body_for_content_types/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_additionalproperties_can_exist_by_itself_response_body_for_content_types/post/__init__.pyi new file mode 100644 index 00000000000..cf307c760c0 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_additionalproperties_can_exist_by_itself_response_body_for_content_types/post/__init__.pyi @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from . import response_for_200 + +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_additionalproperties_can_exist_by_itself_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_additionalproperties_can_exist_by_itself_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_additionalproperties_can_exist_by_itself_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_additionalproperties_can_exist_by_itself_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostAdditionalpropertiesCanExistByItselfResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_additionalproperties_can_exist_by_itself_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_additionalproperties_can_exist_by_itself_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_additionalproperties_can_exist_by_itself_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_additionalproperties_can_exist_by_itself_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_additionalproperties_can_exist_by_itself_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_additionalproperties_can_exist_by_itself_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_additionalproperties_can_exist_by_itself_response_body_for_content_types/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_additionalproperties_can_exist_by_itself_response_body_for_content_types/post/response_for_200.py new file mode 100644 index 00000000000..007ef0529d2 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_additionalproperties_can_exist_by_itself_response_body_for_content_types/post/response_for_200.py @@ -0,0 +1,43 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.additionalproperties_can_exist_by_itself import AdditionalpropertiesCanExistByItself + + +class BodySchemas: + # body schemas + application_json = AdditionalpropertiesCanExistByItself + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_additionalproperties_should_not_look_in_applicators_response_body_for_content_types/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_additionalproperties_should_not_look_in_applicators_response_body_for_content_types/post.py deleted file mode 100644 index 08339309f7a..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_additionalproperties_should_not_look_in_applicators_response_body_for_content_types/post.py +++ /dev/null @@ -1,234 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.additionalproperties_should_not_look_in_applicators import AdditionalpropertiesShouldNotLookInApplicators - -from . import path - -SchemaFor200ResponseBodyApplicationJson = AdditionalpropertiesShouldNotLookInApplicators - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_status_code_to_response = { - '200': _response_for_200, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_additionalproperties_should_not_look_in_applicators_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_additionalproperties_should_not_look_in_applicators_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_additionalproperties_should_not_look_in_applicators_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_additionalproperties_should_not_look_in_applicators_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostAdditionalpropertiesShouldNotLookInApplicatorsResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_additionalproperties_should_not_look_in_applicators_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_additionalproperties_should_not_look_in_applicators_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_additionalproperties_should_not_look_in_applicators_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_additionalproperties_should_not_look_in_applicators_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_additionalproperties_should_not_look_in_applicators_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_additionalproperties_should_not_look_in_applicators_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_additionalproperties_should_not_look_in_applicators_response_body_for_content_types/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_additionalproperties_should_not_look_in_applicators_response_body_for_content_types/post.pyi deleted file mode 100644 index 11163b1c9ed..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_additionalproperties_should_not_look_in_applicators_response_body_for_content_types/post.pyi +++ /dev/null @@ -1,229 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.additionalproperties_should_not_look_in_applicators import AdditionalpropertiesShouldNotLookInApplicators - -SchemaFor200ResponseBodyApplicationJson = AdditionalpropertiesShouldNotLookInApplicators - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_additionalproperties_should_not_look_in_applicators_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_additionalproperties_should_not_look_in_applicators_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_additionalproperties_should_not_look_in_applicators_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_additionalproperties_should_not_look_in_applicators_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostAdditionalpropertiesShouldNotLookInApplicatorsResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_additionalproperties_should_not_look_in_applicators_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_additionalproperties_should_not_look_in_applicators_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_additionalproperties_should_not_look_in_applicators_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_additionalproperties_should_not_look_in_applicators_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_additionalproperties_should_not_look_in_applicators_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_additionalproperties_should_not_look_in_applicators_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_additionalproperties_should_not_look_in_applicators_response_body_for_content_types/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_additionalproperties_should_not_look_in_applicators_response_body_for_content_types/post/__init__.py new file mode 100644 index 00000000000..3230754f9ac --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_additionalproperties_should_not_look_in_applicators_response_body_for_content_types/post/__init__.py @@ -0,0 +1,215 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 + + +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_additionalproperties_should_not_look_in_applicators_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_additionalproperties_should_not_look_in_applicators_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_additionalproperties_should_not_look_in_applicators_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_additionalproperties_should_not_look_in_applicators_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostAdditionalpropertiesShouldNotLookInApplicatorsResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_additionalproperties_should_not_look_in_applicators_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_additionalproperties_should_not_look_in_applicators_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_additionalproperties_should_not_look_in_applicators_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_additionalproperties_should_not_look_in_applicators_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_additionalproperties_should_not_look_in_applicators_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_additionalproperties_should_not_look_in_applicators_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_additionalproperties_should_not_look_in_applicators_response_body_for_content_types/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_additionalproperties_should_not_look_in_applicators_response_body_for_content_types/post/__init__.pyi new file mode 100644 index 00000000000..91f80628876 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_additionalproperties_should_not_look_in_applicators_response_body_for_content_types/post/__init__.pyi @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from . import response_for_200 + +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_additionalproperties_should_not_look_in_applicators_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_additionalproperties_should_not_look_in_applicators_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_additionalproperties_should_not_look_in_applicators_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_additionalproperties_should_not_look_in_applicators_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostAdditionalpropertiesShouldNotLookInApplicatorsResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_additionalproperties_should_not_look_in_applicators_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_additionalproperties_should_not_look_in_applicators_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_additionalproperties_should_not_look_in_applicators_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_additionalproperties_should_not_look_in_applicators_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_additionalproperties_should_not_look_in_applicators_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_additionalproperties_should_not_look_in_applicators_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_additionalproperties_should_not_look_in_applicators_response_body_for_content_types/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_additionalproperties_should_not_look_in_applicators_response_body_for_content_types/post/response_for_200.py new file mode 100644 index 00000000000..31aee282fc4 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_additionalproperties_should_not_look_in_applicators_response_body_for_content_types/post/response_for_200.py @@ -0,0 +1,43 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.additionalproperties_should_not_look_in_applicators import AdditionalpropertiesShouldNotLookInApplicators + + +class BodySchemas: + # body schemas + application_json = AdditionalpropertiesShouldNotLookInApplicators + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_combined_with_anyof_oneof_response_body_for_content_types/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_combined_with_anyof_oneof_response_body_for_content_types/post.py deleted file mode 100644 index 8d431a16108..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_combined_with_anyof_oneof_response_body_for_content_types/post.py +++ /dev/null @@ -1,234 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.allof_combined_with_anyof_oneof import AllofCombinedWithAnyofOneof - -from . import path - -SchemaFor200ResponseBodyApplicationJson = AllofCombinedWithAnyofOneof - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_status_code_to_response = { - '200': _response_for_200, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_allof_combined_with_anyof_oneof_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_allof_combined_with_anyof_oneof_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_allof_combined_with_anyof_oneof_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_allof_combined_with_anyof_oneof_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostAllofCombinedWithAnyofOneofResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_allof_combined_with_anyof_oneof_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_allof_combined_with_anyof_oneof_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_allof_combined_with_anyof_oneof_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_allof_combined_with_anyof_oneof_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_allof_combined_with_anyof_oneof_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_allof_combined_with_anyof_oneof_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_combined_with_anyof_oneof_response_body_for_content_types/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_combined_with_anyof_oneof_response_body_for_content_types/post.pyi deleted file mode 100644 index a5da83b5659..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_combined_with_anyof_oneof_response_body_for_content_types/post.pyi +++ /dev/null @@ -1,229 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.allof_combined_with_anyof_oneof import AllofCombinedWithAnyofOneof - -SchemaFor200ResponseBodyApplicationJson = AllofCombinedWithAnyofOneof - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_allof_combined_with_anyof_oneof_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_allof_combined_with_anyof_oneof_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_allof_combined_with_anyof_oneof_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_allof_combined_with_anyof_oneof_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostAllofCombinedWithAnyofOneofResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_allof_combined_with_anyof_oneof_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_allof_combined_with_anyof_oneof_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_allof_combined_with_anyof_oneof_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_allof_combined_with_anyof_oneof_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_allof_combined_with_anyof_oneof_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_allof_combined_with_anyof_oneof_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_combined_with_anyof_oneof_response_body_for_content_types/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_combined_with_anyof_oneof_response_body_for_content_types/post/__init__.py new file mode 100644 index 00000000000..00c6f047ce4 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_combined_with_anyof_oneof_response_body_for_content_types/post/__init__.py @@ -0,0 +1,215 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 + + +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_allof_combined_with_anyof_oneof_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_allof_combined_with_anyof_oneof_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_allof_combined_with_anyof_oneof_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_allof_combined_with_anyof_oneof_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostAllofCombinedWithAnyofOneofResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_allof_combined_with_anyof_oneof_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_allof_combined_with_anyof_oneof_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_allof_combined_with_anyof_oneof_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_allof_combined_with_anyof_oneof_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_allof_combined_with_anyof_oneof_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_allof_combined_with_anyof_oneof_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_combined_with_anyof_oneof_response_body_for_content_types/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_combined_with_anyof_oneof_response_body_for_content_types/post/__init__.pyi new file mode 100644 index 00000000000..e602d8d41ce --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_combined_with_anyof_oneof_response_body_for_content_types/post/__init__.pyi @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from . import response_for_200 + +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_allof_combined_with_anyof_oneof_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_allof_combined_with_anyof_oneof_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_allof_combined_with_anyof_oneof_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_allof_combined_with_anyof_oneof_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostAllofCombinedWithAnyofOneofResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_allof_combined_with_anyof_oneof_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_allof_combined_with_anyof_oneof_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_allof_combined_with_anyof_oneof_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_allof_combined_with_anyof_oneof_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_allof_combined_with_anyof_oneof_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_allof_combined_with_anyof_oneof_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_combined_with_anyof_oneof_response_body_for_content_types/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_combined_with_anyof_oneof_response_body_for_content_types/post/response_for_200.py new file mode 100644 index 00000000000..40ad0e960d6 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_combined_with_anyof_oneof_response_body_for_content_types/post/response_for_200.py @@ -0,0 +1,43 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.allof_combined_with_anyof_oneof import AllofCombinedWithAnyofOneof + + +class BodySchemas: + # body schemas + application_json = AllofCombinedWithAnyofOneof + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_response_body_for_content_types/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_response_body_for_content_types/post.py deleted file mode 100644 index f6c037767dd..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_response_body_for_content_types/post.py +++ /dev/null @@ -1,234 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.allof import Allof - -from . import path - -SchemaFor200ResponseBodyApplicationJson = Allof - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_status_code_to_response = { - '200': _response_for_200, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_allof_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_allof_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_allof_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_allof_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostAllofResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_allof_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_allof_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_allof_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_allof_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_allof_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_allof_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_response_body_for_content_types/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_response_body_for_content_types/post.pyi deleted file mode 100644 index 07ec804e206..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_response_body_for_content_types/post.pyi +++ /dev/null @@ -1,229 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.allof import Allof - -SchemaFor200ResponseBodyApplicationJson = Allof - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_allof_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_allof_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_allof_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_allof_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostAllofResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_allof_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_allof_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_allof_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_allof_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_allof_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_allof_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_response_body_for_content_types/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_response_body_for_content_types/post/__init__.py new file mode 100644 index 00000000000..9cfb525178a --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_response_body_for_content_types/post/__init__.py @@ -0,0 +1,215 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 + + +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_allof_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_allof_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_allof_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_allof_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostAllofResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_allof_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_allof_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_allof_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_allof_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_allof_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_allof_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_response_body_for_content_types/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_response_body_for_content_types/post/__init__.pyi new file mode 100644 index 00000000000..136a7d1a1f4 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_response_body_for_content_types/post/__init__.pyi @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from . import response_for_200 + +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_allof_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_allof_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_allof_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_allof_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostAllofResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_allof_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_allof_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_allof_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_allof_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_allof_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_allof_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_response_body_for_content_types/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_response_body_for_content_types/post/response_for_200.py new file mode 100644 index 00000000000..18a577b40e8 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_response_body_for_content_types/post/response_for_200.py @@ -0,0 +1,43 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.allof import Allof + + +class BodySchemas: + # body schemas + application_json = Allof + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_simple_types_response_body_for_content_types/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_simple_types_response_body_for_content_types/post.py deleted file mode 100644 index 77f0a396a21..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_simple_types_response_body_for_content_types/post.py +++ /dev/null @@ -1,234 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.allof_simple_types import AllofSimpleTypes - -from . import path - -SchemaFor200ResponseBodyApplicationJson = AllofSimpleTypes - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_status_code_to_response = { - '200': _response_for_200, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_allof_simple_types_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_allof_simple_types_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_allof_simple_types_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_allof_simple_types_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostAllofSimpleTypesResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_allof_simple_types_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_allof_simple_types_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_allof_simple_types_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_allof_simple_types_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_allof_simple_types_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_allof_simple_types_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_simple_types_response_body_for_content_types/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_simple_types_response_body_for_content_types/post.pyi deleted file mode 100644 index 9a539d77891..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_simple_types_response_body_for_content_types/post.pyi +++ /dev/null @@ -1,229 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.allof_simple_types import AllofSimpleTypes - -SchemaFor200ResponseBodyApplicationJson = AllofSimpleTypes - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_allof_simple_types_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_allof_simple_types_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_allof_simple_types_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_allof_simple_types_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostAllofSimpleTypesResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_allof_simple_types_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_allof_simple_types_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_allof_simple_types_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_allof_simple_types_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_allof_simple_types_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_allof_simple_types_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_simple_types_response_body_for_content_types/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_simple_types_response_body_for_content_types/post/__init__.py new file mode 100644 index 00000000000..9fc1af83bb2 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_simple_types_response_body_for_content_types/post/__init__.py @@ -0,0 +1,215 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 + + +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_allof_simple_types_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_allof_simple_types_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_allof_simple_types_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_allof_simple_types_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostAllofSimpleTypesResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_allof_simple_types_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_allof_simple_types_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_allof_simple_types_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_allof_simple_types_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_allof_simple_types_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_allof_simple_types_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_simple_types_response_body_for_content_types/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_simple_types_response_body_for_content_types/post/__init__.pyi new file mode 100644 index 00000000000..01d84a97413 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_simple_types_response_body_for_content_types/post/__init__.pyi @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from . import response_for_200 + +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_allof_simple_types_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_allof_simple_types_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_allof_simple_types_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_allof_simple_types_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostAllofSimpleTypesResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_allof_simple_types_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_allof_simple_types_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_allof_simple_types_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_allof_simple_types_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_allof_simple_types_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_allof_simple_types_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_simple_types_response_body_for_content_types/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_simple_types_response_body_for_content_types/post/response_for_200.py new file mode 100644 index 00000000000..ce2aaa67ab2 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_simple_types_response_body_for_content_types/post/response_for_200.py @@ -0,0 +1,43 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.allof_simple_types import AllofSimpleTypes + + +class BodySchemas: + # body schemas + application_json = AllofSimpleTypes + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_with_base_schema_response_body_for_content_types/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_with_base_schema_response_body_for_content_types/post.py deleted file mode 100644 index 419a5d97d3e..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_with_base_schema_response_body_for_content_types/post.py +++ /dev/null @@ -1,234 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.allof_with_base_schema import AllofWithBaseSchema - -from . import path - -SchemaFor200ResponseBodyApplicationJson = AllofWithBaseSchema - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_status_code_to_response = { - '200': _response_for_200, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_allof_with_base_schema_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_allof_with_base_schema_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_allof_with_base_schema_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_allof_with_base_schema_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostAllofWithBaseSchemaResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_allof_with_base_schema_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_allof_with_base_schema_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_allof_with_base_schema_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_allof_with_base_schema_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_allof_with_base_schema_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_allof_with_base_schema_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_with_base_schema_response_body_for_content_types/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_with_base_schema_response_body_for_content_types/post.pyi deleted file mode 100644 index 2e942812df7..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_with_base_schema_response_body_for_content_types/post.pyi +++ /dev/null @@ -1,229 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.allof_with_base_schema import AllofWithBaseSchema - -SchemaFor200ResponseBodyApplicationJson = AllofWithBaseSchema - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_allof_with_base_schema_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_allof_with_base_schema_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_allof_with_base_schema_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_allof_with_base_schema_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostAllofWithBaseSchemaResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_allof_with_base_schema_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_allof_with_base_schema_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_allof_with_base_schema_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_allof_with_base_schema_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_allof_with_base_schema_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_allof_with_base_schema_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_with_base_schema_response_body_for_content_types/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_with_base_schema_response_body_for_content_types/post/__init__.py new file mode 100644 index 00000000000..40a2737708c --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_with_base_schema_response_body_for_content_types/post/__init__.py @@ -0,0 +1,215 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 + + +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_allof_with_base_schema_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_allof_with_base_schema_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_allof_with_base_schema_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_allof_with_base_schema_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostAllofWithBaseSchemaResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_allof_with_base_schema_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_allof_with_base_schema_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_allof_with_base_schema_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_allof_with_base_schema_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_allof_with_base_schema_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_allof_with_base_schema_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_with_base_schema_response_body_for_content_types/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_with_base_schema_response_body_for_content_types/post/__init__.pyi new file mode 100644 index 00000000000..999ec1c2260 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_with_base_schema_response_body_for_content_types/post/__init__.pyi @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from . import response_for_200 + +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_allof_with_base_schema_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_allof_with_base_schema_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_allof_with_base_schema_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_allof_with_base_schema_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostAllofWithBaseSchemaResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_allof_with_base_schema_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_allof_with_base_schema_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_allof_with_base_schema_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_allof_with_base_schema_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_allof_with_base_schema_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_allof_with_base_schema_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_with_base_schema_response_body_for_content_types/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_with_base_schema_response_body_for_content_types/post/response_for_200.py new file mode 100644 index 00000000000..ce573e7ee2f --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_with_base_schema_response_body_for_content_types/post/response_for_200.py @@ -0,0 +1,43 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.allof_with_base_schema import AllofWithBaseSchema + + +class BodySchemas: + # body schemas + application_json = AllofWithBaseSchema + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_with_one_empty_schema_response_body_for_content_types/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_with_one_empty_schema_response_body_for_content_types/post.py deleted file mode 100644 index 84a474e909a..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_with_one_empty_schema_response_body_for_content_types/post.py +++ /dev/null @@ -1,234 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.allof_with_one_empty_schema import AllofWithOneEmptySchema - -from . import path - -SchemaFor200ResponseBodyApplicationJson = AllofWithOneEmptySchema - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_status_code_to_response = { - '200': _response_for_200, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_allof_with_one_empty_schema_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_allof_with_one_empty_schema_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_allof_with_one_empty_schema_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_allof_with_one_empty_schema_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostAllofWithOneEmptySchemaResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_allof_with_one_empty_schema_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_allof_with_one_empty_schema_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_allof_with_one_empty_schema_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_allof_with_one_empty_schema_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_allof_with_one_empty_schema_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_allof_with_one_empty_schema_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_with_one_empty_schema_response_body_for_content_types/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_with_one_empty_schema_response_body_for_content_types/post.pyi deleted file mode 100644 index 6b727ad4f8a..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_with_one_empty_schema_response_body_for_content_types/post.pyi +++ /dev/null @@ -1,229 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.allof_with_one_empty_schema import AllofWithOneEmptySchema - -SchemaFor200ResponseBodyApplicationJson = AllofWithOneEmptySchema - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_allof_with_one_empty_schema_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_allof_with_one_empty_schema_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_allof_with_one_empty_schema_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_allof_with_one_empty_schema_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostAllofWithOneEmptySchemaResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_allof_with_one_empty_schema_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_allof_with_one_empty_schema_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_allof_with_one_empty_schema_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_allof_with_one_empty_schema_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_allof_with_one_empty_schema_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_allof_with_one_empty_schema_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_with_one_empty_schema_response_body_for_content_types/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_with_one_empty_schema_response_body_for_content_types/post/__init__.py new file mode 100644 index 00000000000..6fb164266e8 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_with_one_empty_schema_response_body_for_content_types/post/__init__.py @@ -0,0 +1,215 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 + + +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_allof_with_one_empty_schema_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_allof_with_one_empty_schema_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_allof_with_one_empty_schema_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_allof_with_one_empty_schema_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostAllofWithOneEmptySchemaResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_allof_with_one_empty_schema_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_allof_with_one_empty_schema_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_allof_with_one_empty_schema_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_allof_with_one_empty_schema_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_allof_with_one_empty_schema_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_allof_with_one_empty_schema_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_with_one_empty_schema_response_body_for_content_types/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_with_one_empty_schema_response_body_for_content_types/post/__init__.pyi new file mode 100644 index 00000000000..58fdd7c607b --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_with_one_empty_schema_response_body_for_content_types/post/__init__.pyi @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from . import response_for_200 + +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_allof_with_one_empty_schema_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_allof_with_one_empty_schema_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_allof_with_one_empty_schema_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_allof_with_one_empty_schema_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostAllofWithOneEmptySchemaResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_allof_with_one_empty_schema_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_allof_with_one_empty_schema_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_allof_with_one_empty_schema_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_allof_with_one_empty_schema_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_allof_with_one_empty_schema_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_allof_with_one_empty_schema_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_with_one_empty_schema_response_body_for_content_types/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_with_one_empty_schema_response_body_for_content_types/post/response_for_200.py new file mode 100644 index 00000000000..1f0102cb7bd --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_with_one_empty_schema_response_body_for_content_types/post/response_for_200.py @@ -0,0 +1,43 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.allof_with_one_empty_schema import AllofWithOneEmptySchema + + +class BodySchemas: + # body schemas + application_json = AllofWithOneEmptySchema + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_with_the_first_empty_schema_response_body_for_content_types/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_with_the_first_empty_schema_response_body_for_content_types/post.py deleted file mode 100644 index ef1b3dbf401..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_with_the_first_empty_schema_response_body_for_content_types/post.py +++ /dev/null @@ -1,234 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.allof_with_the_first_empty_schema import AllofWithTheFirstEmptySchema - -from . import path - -SchemaFor200ResponseBodyApplicationJson = AllofWithTheFirstEmptySchema - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_status_code_to_response = { - '200': _response_for_200, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_allof_with_the_first_empty_schema_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_allof_with_the_first_empty_schema_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_allof_with_the_first_empty_schema_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_allof_with_the_first_empty_schema_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostAllofWithTheFirstEmptySchemaResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_allof_with_the_first_empty_schema_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_allof_with_the_first_empty_schema_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_allof_with_the_first_empty_schema_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_allof_with_the_first_empty_schema_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_allof_with_the_first_empty_schema_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_allof_with_the_first_empty_schema_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_with_the_first_empty_schema_response_body_for_content_types/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_with_the_first_empty_schema_response_body_for_content_types/post.pyi deleted file mode 100644 index ced149513ab..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_with_the_first_empty_schema_response_body_for_content_types/post.pyi +++ /dev/null @@ -1,229 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.allof_with_the_first_empty_schema import AllofWithTheFirstEmptySchema - -SchemaFor200ResponseBodyApplicationJson = AllofWithTheFirstEmptySchema - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_allof_with_the_first_empty_schema_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_allof_with_the_first_empty_schema_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_allof_with_the_first_empty_schema_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_allof_with_the_first_empty_schema_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostAllofWithTheFirstEmptySchemaResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_allof_with_the_first_empty_schema_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_allof_with_the_first_empty_schema_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_allof_with_the_first_empty_schema_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_allof_with_the_first_empty_schema_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_allof_with_the_first_empty_schema_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_allof_with_the_first_empty_schema_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_with_the_first_empty_schema_response_body_for_content_types/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_with_the_first_empty_schema_response_body_for_content_types/post/__init__.py new file mode 100644 index 00000000000..e80b1452acf --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_with_the_first_empty_schema_response_body_for_content_types/post/__init__.py @@ -0,0 +1,215 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 + + +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_allof_with_the_first_empty_schema_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_allof_with_the_first_empty_schema_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_allof_with_the_first_empty_schema_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_allof_with_the_first_empty_schema_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostAllofWithTheFirstEmptySchemaResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_allof_with_the_first_empty_schema_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_allof_with_the_first_empty_schema_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_allof_with_the_first_empty_schema_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_allof_with_the_first_empty_schema_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_allof_with_the_first_empty_schema_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_allof_with_the_first_empty_schema_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_with_the_first_empty_schema_response_body_for_content_types/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_with_the_first_empty_schema_response_body_for_content_types/post/__init__.pyi new file mode 100644 index 00000000000..a1142ad8fcb --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_with_the_first_empty_schema_response_body_for_content_types/post/__init__.pyi @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from . import response_for_200 + +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_allof_with_the_first_empty_schema_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_allof_with_the_first_empty_schema_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_allof_with_the_first_empty_schema_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_allof_with_the_first_empty_schema_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostAllofWithTheFirstEmptySchemaResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_allof_with_the_first_empty_schema_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_allof_with_the_first_empty_schema_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_allof_with_the_first_empty_schema_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_allof_with_the_first_empty_schema_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_allof_with_the_first_empty_schema_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_allof_with_the_first_empty_schema_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_with_the_first_empty_schema_response_body_for_content_types/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_with_the_first_empty_schema_response_body_for_content_types/post/response_for_200.py new file mode 100644 index 00000000000..909b883c1a1 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_with_the_first_empty_schema_response_body_for_content_types/post/response_for_200.py @@ -0,0 +1,43 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.allof_with_the_first_empty_schema import AllofWithTheFirstEmptySchema + + +class BodySchemas: + # body schemas + application_json = AllofWithTheFirstEmptySchema + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_with_the_last_empty_schema_response_body_for_content_types/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_with_the_last_empty_schema_response_body_for_content_types/post.py deleted file mode 100644 index 4abb4c3a69d..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_with_the_last_empty_schema_response_body_for_content_types/post.py +++ /dev/null @@ -1,234 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.allof_with_the_last_empty_schema import AllofWithTheLastEmptySchema - -from . import path - -SchemaFor200ResponseBodyApplicationJson = AllofWithTheLastEmptySchema - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_status_code_to_response = { - '200': _response_for_200, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_allof_with_the_last_empty_schema_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_allof_with_the_last_empty_schema_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_allof_with_the_last_empty_schema_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_allof_with_the_last_empty_schema_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostAllofWithTheLastEmptySchemaResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_allof_with_the_last_empty_schema_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_allof_with_the_last_empty_schema_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_allof_with_the_last_empty_schema_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_allof_with_the_last_empty_schema_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_allof_with_the_last_empty_schema_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_allof_with_the_last_empty_schema_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_with_the_last_empty_schema_response_body_for_content_types/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_with_the_last_empty_schema_response_body_for_content_types/post.pyi deleted file mode 100644 index 19ed64f5a35..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_with_the_last_empty_schema_response_body_for_content_types/post.pyi +++ /dev/null @@ -1,229 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.allof_with_the_last_empty_schema import AllofWithTheLastEmptySchema - -SchemaFor200ResponseBodyApplicationJson = AllofWithTheLastEmptySchema - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_allof_with_the_last_empty_schema_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_allof_with_the_last_empty_schema_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_allof_with_the_last_empty_schema_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_allof_with_the_last_empty_schema_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostAllofWithTheLastEmptySchemaResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_allof_with_the_last_empty_schema_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_allof_with_the_last_empty_schema_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_allof_with_the_last_empty_schema_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_allof_with_the_last_empty_schema_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_allof_with_the_last_empty_schema_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_allof_with_the_last_empty_schema_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_with_the_last_empty_schema_response_body_for_content_types/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_with_the_last_empty_schema_response_body_for_content_types/post/__init__.py new file mode 100644 index 00000000000..35633c56390 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_with_the_last_empty_schema_response_body_for_content_types/post/__init__.py @@ -0,0 +1,215 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 + + +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_allof_with_the_last_empty_schema_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_allof_with_the_last_empty_schema_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_allof_with_the_last_empty_schema_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_allof_with_the_last_empty_schema_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostAllofWithTheLastEmptySchemaResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_allof_with_the_last_empty_schema_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_allof_with_the_last_empty_schema_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_allof_with_the_last_empty_schema_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_allof_with_the_last_empty_schema_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_allof_with_the_last_empty_schema_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_allof_with_the_last_empty_schema_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_with_the_last_empty_schema_response_body_for_content_types/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_with_the_last_empty_schema_response_body_for_content_types/post/__init__.pyi new file mode 100644 index 00000000000..5edc17b99f0 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_with_the_last_empty_schema_response_body_for_content_types/post/__init__.pyi @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from . import response_for_200 + +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_allof_with_the_last_empty_schema_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_allof_with_the_last_empty_schema_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_allof_with_the_last_empty_schema_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_allof_with_the_last_empty_schema_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostAllofWithTheLastEmptySchemaResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_allof_with_the_last_empty_schema_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_allof_with_the_last_empty_schema_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_allof_with_the_last_empty_schema_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_allof_with_the_last_empty_schema_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_allof_with_the_last_empty_schema_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_allof_with_the_last_empty_schema_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_with_the_last_empty_schema_response_body_for_content_types/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_with_the_last_empty_schema_response_body_for_content_types/post/response_for_200.py new file mode 100644 index 00000000000..bcaea6d5ef0 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_with_the_last_empty_schema_response_body_for_content_types/post/response_for_200.py @@ -0,0 +1,43 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.allof_with_the_last_empty_schema import AllofWithTheLastEmptySchema + + +class BodySchemas: + # body schemas + application_json = AllofWithTheLastEmptySchema + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_with_two_empty_schemas_response_body_for_content_types/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_with_two_empty_schemas_response_body_for_content_types/post.py deleted file mode 100644 index b59cf91ebb5..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_with_two_empty_schemas_response_body_for_content_types/post.py +++ /dev/null @@ -1,234 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.allof_with_two_empty_schemas import AllofWithTwoEmptySchemas - -from . import path - -SchemaFor200ResponseBodyApplicationJson = AllofWithTwoEmptySchemas - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_status_code_to_response = { - '200': _response_for_200, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_allof_with_two_empty_schemas_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_allof_with_two_empty_schemas_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_allof_with_two_empty_schemas_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_allof_with_two_empty_schemas_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostAllofWithTwoEmptySchemasResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_allof_with_two_empty_schemas_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_allof_with_two_empty_schemas_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_allof_with_two_empty_schemas_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_allof_with_two_empty_schemas_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_allof_with_two_empty_schemas_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_allof_with_two_empty_schemas_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_with_two_empty_schemas_response_body_for_content_types/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_with_two_empty_schemas_response_body_for_content_types/post.pyi deleted file mode 100644 index 5df855bcae2..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_with_two_empty_schemas_response_body_for_content_types/post.pyi +++ /dev/null @@ -1,229 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.allof_with_two_empty_schemas import AllofWithTwoEmptySchemas - -SchemaFor200ResponseBodyApplicationJson = AllofWithTwoEmptySchemas - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_allof_with_two_empty_schemas_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_allof_with_two_empty_schemas_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_allof_with_two_empty_schemas_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_allof_with_two_empty_schemas_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostAllofWithTwoEmptySchemasResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_allof_with_two_empty_schemas_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_allof_with_two_empty_schemas_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_allof_with_two_empty_schemas_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_allof_with_two_empty_schemas_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_allof_with_two_empty_schemas_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_allof_with_two_empty_schemas_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_with_two_empty_schemas_response_body_for_content_types/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_with_two_empty_schemas_response_body_for_content_types/post/__init__.py new file mode 100644 index 00000000000..76522db4c85 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_with_two_empty_schemas_response_body_for_content_types/post/__init__.py @@ -0,0 +1,215 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 + + +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_allof_with_two_empty_schemas_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_allof_with_two_empty_schemas_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_allof_with_two_empty_schemas_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_allof_with_two_empty_schemas_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostAllofWithTwoEmptySchemasResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_allof_with_two_empty_schemas_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_allof_with_two_empty_schemas_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_allof_with_two_empty_schemas_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_allof_with_two_empty_schemas_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_allof_with_two_empty_schemas_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_allof_with_two_empty_schemas_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_with_two_empty_schemas_response_body_for_content_types/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_with_two_empty_schemas_response_body_for_content_types/post/__init__.pyi new file mode 100644 index 00000000000..d62a026fa33 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_with_two_empty_schemas_response_body_for_content_types/post/__init__.pyi @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from . import response_for_200 + +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_allof_with_two_empty_schemas_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_allof_with_two_empty_schemas_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_allof_with_two_empty_schemas_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_allof_with_two_empty_schemas_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostAllofWithTwoEmptySchemasResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_allof_with_two_empty_schemas_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_allof_with_two_empty_schemas_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_allof_with_two_empty_schemas_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_allof_with_two_empty_schemas_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_allof_with_two_empty_schemas_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_allof_with_two_empty_schemas_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_with_two_empty_schemas_response_body_for_content_types/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_with_two_empty_schemas_response_body_for_content_types/post/response_for_200.py new file mode 100644 index 00000000000..debdab6dd57 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_allof_with_two_empty_schemas_response_body_for_content_types/post/response_for_200.py @@ -0,0 +1,43 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.allof_with_two_empty_schemas import AllofWithTwoEmptySchemas + + +class BodySchemas: + # body schemas + application_json = AllofWithTwoEmptySchemas + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_anyof_complex_types_response_body_for_content_types/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_anyof_complex_types_response_body_for_content_types/post.py deleted file mode 100644 index 4b50280b15c..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_anyof_complex_types_response_body_for_content_types/post.py +++ /dev/null @@ -1,234 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.anyof_complex_types import AnyofComplexTypes - -from . import path - -SchemaFor200ResponseBodyApplicationJson = AnyofComplexTypes - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_status_code_to_response = { - '200': _response_for_200, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_anyof_complex_types_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_anyof_complex_types_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_anyof_complex_types_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_anyof_complex_types_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostAnyofComplexTypesResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_anyof_complex_types_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_anyof_complex_types_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_anyof_complex_types_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_anyof_complex_types_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_anyof_complex_types_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_anyof_complex_types_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_anyof_complex_types_response_body_for_content_types/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_anyof_complex_types_response_body_for_content_types/post.pyi deleted file mode 100644 index 3403a986260..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_anyof_complex_types_response_body_for_content_types/post.pyi +++ /dev/null @@ -1,229 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.anyof_complex_types import AnyofComplexTypes - -SchemaFor200ResponseBodyApplicationJson = AnyofComplexTypes - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_anyof_complex_types_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_anyof_complex_types_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_anyof_complex_types_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_anyof_complex_types_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostAnyofComplexTypesResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_anyof_complex_types_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_anyof_complex_types_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_anyof_complex_types_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_anyof_complex_types_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_anyof_complex_types_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_anyof_complex_types_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_anyof_complex_types_response_body_for_content_types/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_anyof_complex_types_response_body_for_content_types/post/__init__.py new file mode 100644 index 00000000000..2e4aaaa6c62 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_anyof_complex_types_response_body_for_content_types/post/__init__.py @@ -0,0 +1,215 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 + + +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_anyof_complex_types_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_anyof_complex_types_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_anyof_complex_types_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_anyof_complex_types_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostAnyofComplexTypesResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_anyof_complex_types_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_anyof_complex_types_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_anyof_complex_types_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_anyof_complex_types_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_anyof_complex_types_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_anyof_complex_types_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_anyof_complex_types_response_body_for_content_types/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_anyof_complex_types_response_body_for_content_types/post/__init__.pyi new file mode 100644 index 00000000000..2e550cfe6ac --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_anyof_complex_types_response_body_for_content_types/post/__init__.pyi @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from . import response_for_200 + +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_anyof_complex_types_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_anyof_complex_types_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_anyof_complex_types_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_anyof_complex_types_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostAnyofComplexTypesResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_anyof_complex_types_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_anyof_complex_types_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_anyof_complex_types_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_anyof_complex_types_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_anyof_complex_types_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_anyof_complex_types_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_anyof_complex_types_response_body_for_content_types/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_anyof_complex_types_response_body_for_content_types/post/response_for_200.py new file mode 100644 index 00000000000..a764d4151c2 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_anyof_complex_types_response_body_for_content_types/post/response_for_200.py @@ -0,0 +1,43 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.anyof_complex_types import AnyofComplexTypes + + +class BodySchemas: + # body schemas + application_json = AnyofComplexTypes + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_anyof_response_body_for_content_types/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_anyof_response_body_for_content_types/post.py deleted file mode 100644 index 0da1f065b45..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_anyof_response_body_for_content_types/post.py +++ /dev/null @@ -1,234 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.anyof import Anyof - -from . import path - -SchemaFor200ResponseBodyApplicationJson = Anyof - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_status_code_to_response = { - '200': _response_for_200, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_anyof_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_anyof_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_anyof_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_anyof_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostAnyofResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_anyof_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_anyof_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_anyof_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_anyof_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_anyof_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_anyof_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_anyof_response_body_for_content_types/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_anyof_response_body_for_content_types/post.pyi deleted file mode 100644 index 8dfc9079cbd..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_anyof_response_body_for_content_types/post.pyi +++ /dev/null @@ -1,229 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.anyof import Anyof - -SchemaFor200ResponseBodyApplicationJson = Anyof - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_anyof_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_anyof_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_anyof_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_anyof_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostAnyofResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_anyof_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_anyof_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_anyof_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_anyof_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_anyof_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_anyof_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_anyof_response_body_for_content_types/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_anyof_response_body_for_content_types/post/__init__.py new file mode 100644 index 00000000000..86dcc8269f6 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_anyof_response_body_for_content_types/post/__init__.py @@ -0,0 +1,215 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 + + +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_anyof_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_anyof_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_anyof_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_anyof_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostAnyofResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_anyof_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_anyof_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_anyof_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_anyof_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_anyof_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_anyof_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_anyof_response_body_for_content_types/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_anyof_response_body_for_content_types/post/__init__.pyi new file mode 100644 index 00000000000..1774a5865ce --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_anyof_response_body_for_content_types/post/__init__.pyi @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from . import response_for_200 + +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_anyof_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_anyof_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_anyof_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_anyof_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostAnyofResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_anyof_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_anyof_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_anyof_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_anyof_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_anyof_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_anyof_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_anyof_response_body_for_content_types/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_anyof_response_body_for_content_types/post/response_for_200.py new file mode 100644 index 00000000000..dd0ab63158c --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_anyof_response_body_for_content_types/post/response_for_200.py @@ -0,0 +1,43 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.anyof import Anyof + + +class BodySchemas: + # body schemas + application_json = Anyof + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_anyof_with_base_schema_response_body_for_content_types/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_anyof_with_base_schema_response_body_for_content_types/post.py deleted file mode 100644 index 9eed10462f2..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_anyof_with_base_schema_response_body_for_content_types/post.py +++ /dev/null @@ -1,234 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.anyof_with_base_schema import AnyofWithBaseSchema - -from . import path - -SchemaFor200ResponseBodyApplicationJson = AnyofWithBaseSchema - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_status_code_to_response = { - '200': _response_for_200, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_anyof_with_base_schema_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_anyof_with_base_schema_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_anyof_with_base_schema_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_anyof_with_base_schema_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostAnyofWithBaseSchemaResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_anyof_with_base_schema_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_anyof_with_base_schema_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_anyof_with_base_schema_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_anyof_with_base_schema_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_anyof_with_base_schema_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_anyof_with_base_schema_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_anyof_with_base_schema_response_body_for_content_types/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_anyof_with_base_schema_response_body_for_content_types/post.pyi deleted file mode 100644 index b4114d66b96..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_anyof_with_base_schema_response_body_for_content_types/post.pyi +++ /dev/null @@ -1,229 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.anyof_with_base_schema import AnyofWithBaseSchema - -SchemaFor200ResponseBodyApplicationJson = AnyofWithBaseSchema - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_anyof_with_base_schema_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_anyof_with_base_schema_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_anyof_with_base_schema_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_anyof_with_base_schema_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostAnyofWithBaseSchemaResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_anyof_with_base_schema_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_anyof_with_base_schema_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_anyof_with_base_schema_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_anyof_with_base_schema_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_anyof_with_base_schema_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_anyof_with_base_schema_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_anyof_with_base_schema_response_body_for_content_types/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_anyof_with_base_schema_response_body_for_content_types/post/__init__.py new file mode 100644 index 00000000000..69797ff9d13 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_anyof_with_base_schema_response_body_for_content_types/post/__init__.py @@ -0,0 +1,215 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 + + +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_anyof_with_base_schema_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_anyof_with_base_schema_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_anyof_with_base_schema_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_anyof_with_base_schema_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostAnyofWithBaseSchemaResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_anyof_with_base_schema_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_anyof_with_base_schema_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_anyof_with_base_schema_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_anyof_with_base_schema_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_anyof_with_base_schema_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_anyof_with_base_schema_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_anyof_with_base_schema_response_body_for_content_types/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_anyof_with_base_schema_response_body_for_content_types/post/__init__.pyi new file mode 100644 index 00000000000..eb21ca6f948 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_anyof_with_base_schema_response_body_for_content_types/post/__init__.pyi @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from . import response_for_200 + +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_anyof_with_base_schema_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_anyof_with_base_schema_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_anyof_with_base_schema_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_anyof_with_base_schema_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostAnyofWithBaseSchemaResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_anyof_with_base_schema_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_anyof_with_base_schema_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_anyof_with_base_schema_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_anyof_with_base_schema_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_anyof_with_base_schema_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_anyof_with_base_schema_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_anyof_with_base_schema_response_body_for_content_types/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_anyof_with_base_schema_response_body_for_content_types/post/response_for_200.py new file mode 100644 index 00000000000..483c291a4f8 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_anyof_with_base_schema_response_body_for_content_types/post/response_for_200.py @@ -0,0 +1,43 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.anyof_with_base_schema import AnyofWithBaseSchema + + +class BodySchemas: + # body schemas + application_json = AnyofWithBaseSchema + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_anyof_with_one_empty_schema_response_body_for_content_types/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_anyof_with_one_empty_schema_response_body_for_content_types/post.py deleted file mode 100644 index 041597c8842..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_anyof_with_one_empty_schema_response_body_for_content_types/post.py +++ /dev/null @@ -1,234 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.anyof_with_one_empty_schema import AnyofWithOneEmptySchema - -from . import path - -SchemaFor200ResponseBodyApplicationJson = AnyofWithOneEmptySchema - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_status_code_to_response = { - '200': _response_for_200, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_anyof_with_one_empty_schema_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_anyof_with_one_empty_schema_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_anyof_with_one_empty_schema_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_anyof_with_one_empty_schema_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostAnyofWithOneEmptySchemaResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_anyof_with_one_empty_schema_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_anyof_with_one_empty_schema_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_anyof_with_one_empty_schema_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_anyof_with_one_empty_schema_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_anyof_with_one_empty_schema_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_anyof_with_one_empty_schema_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_anyof_with_one_empty_schema_response_body_for_content_types/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_anyof_with_one_empty_schema_response_body_for_content_types/post.pyi deleted file mode 100644 index 449cf2d063b..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_anyof_with_one_empty_schema_response_body_for_content_types/post.pyi +++ /dev/null @@ -1,229 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.anyof_with_one_empty_schema import AnyofWithOneEmptySchema - -SchemaFor200ResponseBodyApplicationJson = AnyofWithOneEmptySchema - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_anyof_with_one_empty_schema_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_anyof_with_one_empty_schema_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_anyof_with_one_empty_schema_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_anyof_with_one_empty_schema_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostAnyofWithOneEmptySchemaResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_anyof_with_one_empty_schema_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_anyof_with_one_empty_schema_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_anyof_with_one_empty_schema_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_anyof_with_one_empty_schema_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_anyof_with_one_empty_schema_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_anyof_with_one_empty_schema_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_anyof_with_one_empty_schema_response_body_for_content_types/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_anyof_with_one_empty_schema_response_body_for_content_types/post/__init__.py new file mode 100644 index 00000000000..cf1b7811c3d --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_anyof_with_one_empty_schema_response_body_for_content_types/post/__init__.py @@ -0,0 +1,215 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 + + +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_anyof_with_one_empty_schema_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_anyof_with_one_empty_schema_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_anyof_with_one_empty_schema_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_anyof_with_one_empty_schema_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostAnyofWithOneEmptySchemaResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_anyof_with_one_empty_schema_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_anyof_with_one_empty_schema_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_anyof_with_one_empty_schema_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_anyof_with_one_empty_schema_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_anyof_with_one_empty_schema_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_anyof_with_one_empty_schema_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_anyof_with_one_empty_schema_response_body_for_content_types/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_anyof_with_one_empty_schema_response_body_for_content_types/post/__init__.pyi new file mode 100644 index 00000000000..9a465a1d780 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_anyof_with_one_empty_schema_response_body_for_content_types/post/__init__.pyi @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from . import response_for_200 + +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_anyof_with_one_empty_schema_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_anyof_with_one_empty_schema_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_anyof_with_one_empty_schema_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_anyof_with_one_empty_schema_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostAnyofWithOneEmptySchemaResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_anyof_with_one_empty_schema_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_anyof_with_one_empty_schema_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_anyof_with_one_empty_schema_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_anyof_with_one_empty_schema_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_anyof_with_one_empty_schema_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_anyof_with_one_empty_schema_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_anyof_with_one_empty_schema_response_body_for_content_types/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_anyof_with_one_empty_schema_response_body_for_content_types/post/response_for_200.py new file mode 100644 index 00000000000..a2abda27aff --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_anyof_with_one_empty_schema_response_body_for_content_types/post/response_for_200.py @@ -0,0 +1,43 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.anyof_with_one_empty_schema import AnyofWithOneEmptySchema + + +class BodySchemas: + # body schemas + application_json = AnyofWithOneEmptySchema + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_array_type_matches_arrays_response_body_for_content_types/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_array_type_matches_arrays_response_body_for_content_types/post.py deleted file mode 100644 index 3f8cbfe27e6..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_array_type_matches_arrays_response_body_for_content_types/post.py +++ /dev/null @@ -1,234 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.array_type_matches_arrays import ArrayTypeMatchesArrays - -from . import path - -SchemaFor200ResponseBodyApplicationJson = ArrayTypeMatchesArrays - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_status_code_to_response = { - '200': _response_for_200, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_array_type_matches_arrays_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_array_type_matches_arrays_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_array_type_matches_arrays_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_array_type_matches_arrays_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostArrayTypeMatchesArraysResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_array_type_matches_arrays_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_array_type_matches_arrays_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_array_type_matches_arrays_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_array_type_matches_arrays_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_array_type_matches_arrays_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_array_type_matches_arrays_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_array_type_matches_arrays_response_body_for_content_types/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_array_type_matches_arrays_response_body_for_content_types/post.pyi deleted file mode 100644 index 6a639977786..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_array_type_matches_arrays_response_body_for_content_types/post.pyi +++ /dev/null @@ -1,229 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.array_type_matches_arrays import ArrayTypeMatchesArrays - -SchemaFor200ResponseBodyApplicationJson = ArrayTypeMatchesArrays - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_array_type_matches_arrays_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_array_type_matches_arrays_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_array_type_matches_arrays_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_array_type_matches_arrays_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostArrayTypeMatchesArraysResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_array_type_matches_arrays_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_array_type_matches_arrays_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_array_type_matches_arrays_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_array_type_matches_arrays_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_array_type_matches_arrays_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_array_type_matches_arrays_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_array_type_matches_arrays_response_body_for_content_types/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_array_type_matches_arrays_response_body_for_content_types/post/__init__.py new file mode 100644 index 00000000000..23050b20aa3 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_array_type_matches_arrays_response_body_for_content_types/post/__init__.py @@ -0,0 +1,215 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 + + +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_array_type_matches_arrays_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_array_type_matches_arrays_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_array_type_matches_arrays_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_array_type_matches_arrays_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostArrayTypeMatchesArraysResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_array_type_matches_arrays_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_array_type_matches_arrays_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_array_type_matches_arrays_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_array_type_matches_arrays_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_array_type_matches_arrays_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_array_type_matches_arrays_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_array_type_matches_arrays_response_body_for_content_types/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_array_type_matches_arrays_response_body_for_content_types/post/__init__.pyi new file mode 100644 index 00000000000..2baf4b585ba --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_array_type_matches_arrays_response_body_for_content_types/post/__init__.pyi @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from . import response_for_200 + +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_array_type_matches_arrays_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_array_type_matches_arrays_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_array_type_matches_arrays_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_array_type_matches_arrays_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostArrayTypeMatchesArraysResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_array_type_matches_arrays_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_array_type_matches_arrays_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_array_type_matches_arrays_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_array_type_matches_arrays_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_array_type_matches_arrays_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_array_type_matches_arrays_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_array_type_matches_arrays_response_body_for_content_types/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_array_type_matches_arrays_response_body_for_content_types/post/response_for_200.py new file mode 100644 index 00000000000..bc3b7d74563 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_array_type_matches_arrays_response_body_for_content_types/post/response_for_200.py @@ -0,0 +1,43 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.array_type_matches_arrays import ArrayTypeMatchesArrays + + +class BodySchemas: + # body schemas + application_json = ArrayTypeMatchesArrays + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_boolean_type_matches_booleans_response_body_for_content_types/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_boolean_type_matches_booleans_response_body_for_content_types/post.py deleted file mode 100644 index 030b06a8e41..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_boolean_type_matches_booleans_response_body_for_content_types/post.py +++ /dev/null @@ -1,232 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from . import path - -SchemaFor200ResponseBodyApplicationJson = schemas.BoolSchema - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_status_code_to_response = { - '200': _response_for_200, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_boolean_type_matches_booleans_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_boolean_type_matches_booleans_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_boolean_type_matches_booleans_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_boolean_type_matches_booleans_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostBooleanTypeMatchesBooleansResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_boolean_type_matches_booleans_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_boolean_type_matches_booleans_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_boolean_type_matches_booleans_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_boolean_type_matches_booleans_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_boolean_type_matches_booleans_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_boolean_type_matches_booleans_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_boolean_type_matches_booleans_response_body_for_content_types/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_boolean_type_matches_booleans_response_body_for_content_types/post.pyi deleted file mode 100644 index 8dd6262f62a..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_boolean_type_matches_booleans_response_body_for_content_types/post.pyi +++ /dev/null @@ -1,227 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -SchemaFor200ResponseBodyApplicationJson = schemas.BoolSchema - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_boolean_type_matches_booleans_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_boolean_type_matches_booleans_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_boolean_type_matches_booleans_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_boolean_type_matches_booleans_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostBooleanTypeMatchesBooleansResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_boolean_type_matches_booleans_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_boolean_type_matches_booleans_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_boolean_type_matches_booleans_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_boolean_type_matches_booleans_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_boolean_type_matches_booleans_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_boolean_type_matches_booleans_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_boolean_type_matches_booleans_response_body_for_content_types/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_boolean_type_matches_booleans_response_body_for_content_types/post/__init__.py new file mode 100644 index 00000000000..9aaaac2324c --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_boolean_type_matches_booleans_response_body_for_content_types/post/__init__.py @@ -0,0 +1,215 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 + + +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_boolean_type_matches_booleans_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_boolean_type_matches_booleans_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_boolean_type_matches_booleans_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_boolean_type_matches_booleans_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostBooleanTypeMatchesBooleansResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_boolean_type_matches_booleans_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_boolean_type_matches_booleans_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_boolean_type_matches_booleans_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_boolean_type_matches_booleans_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_boolean_type_matches_booleans_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_boolean_type_matches_booleans_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_boolean_type_matches_booleans_response_body_for_content_types/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_boolean_type_matches_booleans_response_body_for_content_types/post/__init__.pyi new file mode 100644 index 00000000000..38cc4bf6821 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_boolean_type_matches_booleans_response_body_for_content_types/post/__init__.pyi @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from . import response_for_200 + +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_boolean_type_matches_booleans_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_boolean_type_matches_booleans_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_boolean_type_matches_booleans_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_boolean_type_matches_booleans_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostBooleanTypeMatchesBooleansResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_boolean_type_matches_booleans_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_boolean_type_matches_booleans_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_boolean_type_matches_booleans_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_boolean_type_matches_booleans_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_boolean_type_matches_booleans_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_boolean_type_matches_booleans_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_boolean_type_matches_booleans_response_body_for_content_types/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_boolean_type_matches_booleans_response_body_for_content_types/post/response_for_200.py new file mode 100644 index 00000000000..3a6acfaf9e9 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_boolean_type_matches_booleans_response_body_for_content_types/post/response_for_200.py @@ -0,0 +1,43 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.boolean_type_matches_booleans import BooleanTypeMatchesBooleans + + +class BodySchemas: + # body schemas + application_json = BooleanTypeMatchesBooleans + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_by_int_response_body_for_content_types/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_by_int_response_body_for_content_types/post.py deleted file mode 100644 index 7062ed0200e..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_by_int_response_body_for_content_types/post.py +++ /dev/null @@ -1,234 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.by_int import ByInt - -from . import path - -SchemaFor200ResponseBodyApplicationJson = ByInt - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_status_code_to_response = { - '200': _response_for_200, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_by_int_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_by_int_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_by_int_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_by_int_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostByIntResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_by_int_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_by_int_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_by_int_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_by_int_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_by_int_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_by_int_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_by_int_response_body_for_content_types/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_by_int_response_body_for_content_types/post.pyi deleted file mode 100644 index 9a7bbae9361..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_by_int_response_body_for_content_types/post.pyi +++ /dev/null @@ -1,229 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.by_int import ByInt - -SchemaFor200ResponseBodyApplicationJson = ByInt - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_by_int_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_by_int_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_by_int_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_by_int_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostByIntResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_by_int_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_by_int_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_by_int_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_by_int_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_by_int_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_by_int_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_by_int_response_body_for_content_types/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_by_int_response_body_for_content_types/post/__init__.py new file mode 100644 index 00000000000..0004a148abe --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_by_int_response_body_for_content_types/post/__init__.py @@ -0,0 +1,215 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 + + +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_by_int_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_by_int_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_by_int_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_by_int_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostByIntResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_by_int_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_by_int_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_by_int_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_by_int_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_by_int_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_by_int_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_by_int_response_body_for_content_types/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_by_int_response_body_for_content_types/post/__init__.pyi new file mode 100644 index 00000000000..6b8fdf3ac14 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_by_int_response_body_for_content_types/post/__init__.pyi @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from . import response_for_200 + +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_by_int_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_by_int_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_by_int_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_by_int_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostByIntResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_by_int_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_by_int_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_by_int_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_by_int_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_by_int_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_by_int_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_by_int_response_body_for_content_types/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_by_int_response_body_for_content_types/post/response_for_200.py new file mode 100644 index 00000000000..61151943408 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_by_int_response_body_for_content_types/post/response_for_200.py @@ -0,0 +1,43 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.by_int import ByInt + + +class BodySchemas: + # body schemas + application_json = ByInt + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_by_number_response_body_for_content_types/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_by_number_response_body_for_content_types/post.py deleted file mode 100644 index f6af5664d40..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_by_number_response_body_for_content_types/post.py +++ /dev/null @@ -1,234 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.by_number import ByNumber - -from . import path - -SchemaFor200ResponseBodyApplicationJson = ByNumber - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_status_code_to_response = { - '200': _response_for_200, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_by_number_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_by_number_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_by_number_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_by_number_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostByNumberResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_by_number_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_by_number_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_by_number_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_by_number_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_by_number_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_by_number_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_by_number_response_body_for_content_types/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_by_number_response_body_for_content_types/post.pyi deleted file mode 100644 index 974ac449f05..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_by_number_response_body_for_content_types/post.pyi +++ /dev/null @@ -1,229 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.by_number import ByNumber - -SchemaFor200ResponseBodyApplicationJson = ByNumber - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_by_number_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_by_number_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_by_number_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_by_number_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostByNumberResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_by_number_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_by_number_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_by_number_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_by_number_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_by_number_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_by_number_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_by_number_response_body_for_content_types/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_by_number_response_body_for_content_types/post/__init__.py new file mode 100644 index 00000000000..345f12c6e01 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_by_number_response_body_for_content_types/post/__init__.py @@ -0,0 +1,215 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 + + +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_by_number_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_by_number_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_by_number_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_by_number_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostByNumberResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_by_number_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_by_number_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_by_number_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_by_number_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_by_number_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_by_number_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_by_number_response_body_for_content_types/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_by_number_response_body_for_content_types/post/__init__.pyi new file mode 100644 index 00000000000..2b951ee6075 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_by_number_response_body_for_content_types/post/__init__.pyi @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from . import response_for_200 + +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_by_number_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_by_number_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_by_number_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_by_number_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostByNumberResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_by_number_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_by_number_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_by_number_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_by_number_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_by_number_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_by_number_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_by_number_response_body_for_content_types/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_by_number_response_body_for_content_types/post/response_for_200.py new file mode 100644 index 00000000000..6d2b5092e10 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_by_number_response_body_for_content_types/post/response_for_200.py @@ -0,0 +1,43 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.by_number import ByNumber + + +class BodySchemas: + # body schemas + application_json = ByNumber + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_by_small_number_response_body_for_content_types/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_by_small_number_response_body_for_content_types/post.py deleted file mode 100644 index b76bb8fbb9c..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_by_small_number_response_body_for_content_types/post.py +++ /dev/null @@ -1,234 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.by_small_number import BySmallNumber - -from . import path - -SchemaFor200ResponseBodyApplicationJson = BySmallNumber - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_status_code_to_response = { - '200': _response_for_200, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_by_small_number_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_by_small_number_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_by_small_number_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_by_small_number_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostBySmallNumberResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_by_small_number_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_by_small_number_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_by_small_number_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_by_small_number_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_by_small_number_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_by_small_number_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_by_small_number_response_body_for_content_types/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_by_small_number_response_body_for_content_types/post.pyi deleted file mode 100644 index ae36ecd550b..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_by_small_number_response_body_for_content_types/post.pyi +++ /dev/null @@ -1,229 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.by_small_number import BySmallNumber - -SchemaFor200ResponseBodyApplicationJson = BySmallNumber - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_by_small_number_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_by_small_number_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_by_small_number_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_by_small_number_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostBySmallNumberResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_by_small_number_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_by_small_number_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_by_small_number_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_by_small_number_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_by_small_number_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_by_small_number_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_by_small_number_response_body_for_content_types/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_by_small_number_response_body_for_content_types/post/__init__.py new file mode 100644 index 00000000000..bed011c3236 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_by_small_number_response_body_for_content_types/post/__init__.py @@ -0,0 +1,215 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 + + +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_by_small_number_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_by_small_number_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_by_small_number_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_by_small_number_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostBySmallNumberResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_by_small_number_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_by_small_number_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_by_small_number_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_by_small_number_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_by_small_number_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_by_small_number_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_by_small_number_response_body_for_content_types/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_by_small_number_response_body_for_content_types/post/__init__.pyi new file mode 100644 index 00000000000..b07c2d90763 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_by_small_number_response_body_for_content_types/post/__init__.pyi @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from . import response_for_200 + +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_by_small_number_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_by_small_number_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_by_small_number_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_by_small_number_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostBySmallNumberResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_by_small_number_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_by_small_number_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_by_small_number_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_by_small_number_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_by_small_number_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_by_small_number_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_by_small_number_response_body_for_content_types/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_by_small_number_response_body_for_content_types/post/response_for_200.py new file mode 100644 index 00000000000..23d15e922bb --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_by_small_number_response_body_for_content_types/post/response_for_200.py @@ -0,0 +1,43 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.by_small_number import BySmallNumber + + +class BodySchemas: + # body schemas + application_json = BySmallNumber + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_date_time_format_response_body_for_content_types/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_date_time_format_response_body_for_content_types/post.pyi deleted file mode 100644 index c05db7d83da..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_date_time_format_response_body_for_content_types/post.pyi +++ /dev/null @@ -1,250 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - - - -class SchemaFor200ResponseBodyApplicationJson( - schemas.DateTimeBase, - schemas.AnyTypeSchema, -): - - - class MetaOapg: - format = 'date-time' - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'SchemaFor200ResponseBodyApplicationJson': - return super().__new__( - cls, - *args, - _configuration=_configuration, - **kwargs, - ) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_date_time_format_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_date_time_format_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_date_time_format_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_date_time_format_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostDateTimeFormatResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_date_time_format_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_date_time_format_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_date_time_format_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_date_time_format_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_date_time_format_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_date_time_format_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_date_time_format_response_body_for_content_types/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_date_time_format_response_body_for_content_types/post/__init__.py new file mode 100644 index 00000000000..d850cf591ac --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_date_time_format_response_body_for_content_types/post/__init__.py @@ -0,0 +1,215 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 + + +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_date_time_format_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_date_time_format_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_date_time_format_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_date_time_format_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostDateTimeFormatResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_date_time_format_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_date_time_format_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_date_time_format_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_date_time_format_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_date_time_format_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_date_time_format_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_date_time_format_response_body_for_content_types/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_date_time_format_response_body_for_content_types/post/__init__.pyi new file mode 100644 index 00000000000..055de255044 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_date_time_format_response_body_for_content_types/post/__init__.pyi @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from . import response_for_200 + +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_date_time_format_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_date_time_format_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_date_time_format_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_date_time_format_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostDateTimeFormatResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_date_time_format_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_date_time_format_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_date_time_format_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_date_time_format_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_date_time_format_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_date_time_format_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_date_time_format_response_body_for_content_types/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_date_time_format_response_body_for_content_types/post/response_for_200.py new file mode 100644 index 00000000000..45d53d38482 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_date_time_format_response_body_for_content_types/post/response_for_200.py @@ -0,0 +1,43 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.date_time_format import DateTimeFormat + + +class BodySchemas: + # body schemas + application_json = DateTimeFormat + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_email_format_response_body_for_content_types/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_email_format_response_body_for_content_types/post.py deleted file mode 100644 index 852d0ec405d..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_email_format_response_body_for_content_types/post.py +++ /dev/null @@ -1,254 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from . import path - - - -class SchemaFor200ResponseBodyApplicationJson( - schemas.AnyTypeSchema, -): - - - class MetaOapg: - format = 'email' - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'SchemaFor200ResponseBodyApplicationJson': - return super().__new__( - cls, - *args, - _configuration=_configuration, - **kwargs, - ) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_status_code_to_response = { - '200': _response_for_200, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_email_format_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_email_format_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_email_format_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_email_format_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostEmailFormatResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_email_format_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_email_format_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_email_format_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_email_format_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_email_format_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_email_format_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_email_format_response_body_for_content_types/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_email_format_response_body_for_content_types/post.pyi deleted file mode 100644 index dfa5becb7a4..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_email_format_response_body_for_content_types/post.pyi +++ /dev/null @@ -1,249 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - - - -class SchemaFor200ResponseBodyApplicationJson( - schemas.AnyTypeSchema, -): - - - class MetaOapg: - format = 'email' - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'SchemaFor200ResponseBodyApplicationJson': - return super().__new__( - cls, - *args, - _configuration=_configuration, - **kwargs, - ) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_email_format_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_email_format_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_email_format_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_email_format_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostEmailFormatResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_email_format_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_email_format_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_email_format_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_email_format_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_email_format_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_email_format_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_email_format_response_body_for_content_types/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_email_format_response_body_for_content_types/post/__init__.py new file mode 100644 index 00000000000..7c2b75e0001 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_email_format_response_body_for_content_types/post/__init__.py @@ -0,0 +1,215 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 + + +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_email_format_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_email_format_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_email_format_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_email_format_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostEmailFormatResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_email_format_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_email_format_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_email_format_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_email_format_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_email_format_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_email_format_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_email_format_response_body_for_content_types/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_email_format_response_body_for_content_types/post/__init__.pyi new file mode 100644 index 00000000000..b08df42e3cb --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_email_format_response_body_for_content_types/post/__init__.pyi @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from . import response_for_200 + +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_email_format_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_email_format_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_email_format_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_email_format_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostEmailFormatResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_email_format_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_email_format_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_email_format_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_email_format_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_email_format_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_email_format_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_email_format_response_body_for_content_types/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_email_format_response_body_for_content_types/post/response_for_200.py new file mode 100644 index 00000000000..8f61992a7fa --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_email_format_response_body_for_content_types/post/response_for_200.py @@ -0,0 +1,43 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.email_format import EmailFormat + + +class BodySchemas: + # body schemas + application_json = EmailFormat + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_enum_with0_does_not_match_false_response_body_for_content_types/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_enum_with0_does_not_match_false_response_body_for_content_types/post.py deleted file mode 100644 index fcaf9122bb2..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_enum_with0_does_not_match_false_response_body_for_content_types/post.py +++ /dev/null @@ -1,234 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.enum_with0_does_not_match_false import EnumWith0DoesNotMatchFalse - -from . import path - -SchemaFor200ResponseBodyApplicationJson = EnumWith0DoesNotMatchFalse - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_status_code_to_response = { - '200': _response_for_200, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_enum_with0_does_not_match_false_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_enum_with0_does_not_match_false_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_enum_with0_does_not_match_false_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_enum_with0_does_not_match_false_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostEnumWith0DoesNotMatchFalseResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_enum_with0_does_not_match_false_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_enum_with0_does_not_match_false_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_enum_with0_does_not_match_false_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_enum_with0_does_not_match_false_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_enum_with0_does_not_match_false_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_enum_with0_does_not_match_false_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_enum_with0_does_not_match_false_response_body_for_content_types/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_enum_with0_does_not_match_false_response_body_for_content_types/post.pyi deleted file mode 100644 index b6dd3e24153..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_enum_with0_does_not_match_false_response_body_for_content_types/post.pyi +++ /dev/null @@ -1,229 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.enum_with0_does_not_match_false import EnumWith0DoesNotMatchFalse - -SchemaFor200ResponseBodyApplicationJson = EnumWith0DoesNotMatchFalse - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_enum_with0_does_not_match_false_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_enum_with0_does_not_match_false_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_enum_with0_does_not_match_false_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_enum_with0_does_not_match_false_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostEnumWith0DoesNotMatchFalseResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_enum_with0_does_not_match_false_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_enum_with0_does_not_match_false_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_enum_with0_does_not_match_false_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_enum_with0_does_not_match_false_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_enum_with0_does_not_match_false_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_enum_with0_does_not_match_false_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_enum_with0_does_not_match_false_response_body_for_content_types/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_enum_with0_does_not_match_false_response_body_for_content_types/post/__init__.py new file mode 100644 index 00000000000..e8af1ba5194 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_enum_with0_does_not_match_false_response_body_for_content_types/post/__init__.py @@ -0,0 +1,215 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 + + +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_enum_with0_does_not_match_false_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_enum_with0_does_not_match_false_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_enum_with0_does_not_match_false_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_enum_with0_does_not_match_false_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostEnumWith0DoesNotMatchFalseResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_enum_with0_does_not_match_false_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_enum_with0_does_not_match_false_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_enum_with0_does_not_match_false_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_enum_with0_does_not_match_false_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_enum_with0_does_not_match_false_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_enum_with0_does_not_match_false_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_enum_with0_does_not_match_false_response_body_for_content_types/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_enum_with0_does_not_match_false_response_body_for_content_types/post/__init__.pyi new file mode 100644 index 00000000000..871847d48db --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_enum_with0_does_not_match_false_response_body_for_content_types/post/__init__.pyi @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from . import response_for_200 + +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_enum_with0_does_not_match_false_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_enum_with0_does_not_match_false_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_enum_with0_does_not_match_false_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_enum_with0_does_not_match_false_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostEnumWith0DoesNotMatchFalseResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_enum_with0_does_not_match_false_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_enum_with0_does_not_match_false_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_enum_with0_does_not_match_false_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_enum_with0_does_not_match_false_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_enum_with0_does_not_match_false_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_enum_with0_does_not_match_false_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_enum_with0_does_not_match_false_response_body_for_content_types/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_enum_with0_does_not_match_false_response_body_for_content_types/post/response_for_200.py new file mode 100644 index 00000000000..62f6d349915 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_enum_with0_does_not_match_false_response_body_for_content_types/post/response_for_200.py @@ -0,0 +1,43 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.enum_with0_does_not_match_false import EnumWith0DoesNotMatchFalse + + +class BodySchemas: + # body schemas + application_json = EnumWith0DoesNotMatchFalse + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_enum_with1_does_not_match_true_response_body_for_content_types/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_enum_with1_does_not_match_true_response_body_for_content_types/post.py deleted file mode 100644 index cf06ad29bef..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_enum_with1_does_not_match_true_response_body_for_content_types/post.py +++ /dev/null @@ -1,234 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.enum_with1_does_not_match_true import EnumWith1DoesNotMatchTrue - -from . import path - -SchemaFor200ResponseBodyApplicationJson = EnumWith1DoesNotMatchTrue - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_status_code_to_response = { - '200': _response_for_200, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_enum_with1_does_not_match_true_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_enum_with1_does_not_match_true_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_enum_with1_does_not_match_true_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_enum_with1_does_not_match_true_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostEnumWith1DoesNotMatchTrueResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_enum_with1_does_not_match_true_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_enum_with1_does_not_match_true_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_enum_with1_does_not_match_true_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_enum_with1_does_not_match_true_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_enum_with1_does_not_match_true_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_enum_with1_does_not_match_true_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_enum_with1_does_not_match_true_response_body_for_content_types/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_enum_with1_does_not_match_true_response_body_for_content_types/post.pyi deleted file mode 100644 index 3e102004f87..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_enum_with1_does_not_match_true_response_body_for_content_types/post.pyi +++ /dev/null @@ -1,229 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.enum_with1_does_not_match_true import EnumWith1DoesNotMatchTrue - -SchemaFor200ResponseBodyApplicationJson = EnumWith1DoesNotMatchTrue - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_enum_with1_does_not_match_true_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_enum_with1_does_not_match_true_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_enum_with1_does_not_match_true_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_enum_with1_does_not_match_true_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostEnumWith1DoesNotMatchTrueResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_enum_with1_does_not_match_true_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_enum_with1_does_not_match_true_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_enum_with1_does_not_match_true_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_enum_with1_does_not_match_true_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_enum_with1_does_not_match_true_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_enum_with1_does_not_match_true_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_enum_with1_does_not_match_true_response_body_for_content_types/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_enum_with1_does_not_match_true_response_body_for_content_types/post/__init__.py new file mode 100644 index 00000000000..77190327a83 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_enum_with1_does_not_match_true_response_body_for_content_types/post/__init__.py @@ -0,0 +1,215 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 + + +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_enum_with1_does_not_match_true_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_enum_with1_does_not_match_true_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_enum_with1_does_not_match_true_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_enum_with1_does_not_match_true_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostEnumWith1DoesNotMatchTrueResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_enum_with1_does_not_match_true_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_enum_with1_does_not_match_true_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_enum_with1_does_not_match_true_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_enum_with1_does_not_match_true_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_enum_with1_does_not_match_true_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_enum_with1_does_not_match_true_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_enum_with1_does_not_match_true_response_body_for_content_types/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_enum_with1_does_not_match_true_response_body_for_content_types/post/__init__.pyi new file mode 100644 index 00000000000..cda6a71566c --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_enum_with1_does_not_match_true_response_body_for_content_types/post/__init__.pyi @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from . import response_for_200 + +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_enum_with1_does_not_match_true_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_enum_with1_does_not_match_true_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_enum_with1_does_not_match_true_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_enum_with1_does_not_match_true_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostEnumWith1DoesNotMatchTrueResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_enum_with1_does_not_match_true_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_enum_with1_does_not_match_true_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_enum_with1_does_not_match_true_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_enum_with1_does_not_match_true_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_enum_with1_does_not_match_true_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_enum_with1_does_not_match_true_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_enum_with1_does_not_match_true_response_body_for_content_types/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_enum_with1_does_not_match_true_response_body_for_content_types/post/response_for_200.py new file mode 100644 index 00000000000..f85b7177f34 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_enum_with1_does_not_match_true_response_body_for_content_types/post/response_for_200.py @@ -0,0 +1,43 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.enum_with1_does_not_match_true import EnumWith1DoesNotMatchTrue + + +class BodySchemas: + # body schemas + application_json = EnumWith1DoesNotMatchTrue + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_enum_with_escaped_characters_response_body_for_content_types/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_enum_with_escaped_characters_response_body_for_content_types/post.py deleted file mode 100644 index 77cceb12c89..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_enum_with_escaped_characters_response_body_for_content_types/post.py +++ /dev/null @@ -1,234 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.enum_with_escaped_characters import EnumWithEscapedCharacters - -from . import path - -SchemaFor200ResponseBodyApplicationJson = EnumWithEscapedCharacters - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_status_code_to_response = { - '200': _response_for_200, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_enum_with_escaped_characters_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_enum_with_escaped_characters_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_enum_with_escaped_characters_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_enum_with_escaped_characters_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostEnumWithEscapedCharactersResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_enum_with_escaped_characters_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_enum_with_escaped_characters_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_enum_with_escaped_characters_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_enum_with_escaped_characters_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_enum_with_escaped_characters_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_enum_with_escaped_characters_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_enum_with_escaped_characters_response_body_for_content_types/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_enum_with_escaped_characters_response_body_for_content_types/post.pyi deleted file mode 100644 index 87ba64d4570..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_enum_with_escaped_characters_response_body_for_content_types/post.pyi +++ /dev/null @@ -1,229 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.enum_with_escaped_characters import EnumWithEscapedCharacters - -SchemaFor200ResponseBodyApplicationJson = EnumWithEscapedCharacters - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_enum_with_escaped_characters_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_enum_with_escaped_characters_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_enum_with_escaped_characters_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_enum_with_escaped_characters_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostEnumWithEscapedCharactersResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_enum_with_escaped_characters_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_enum_with_escaped_characters_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_enum_with_escaped_characters_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_enum_with_escaped_characters_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_enum_with_escaped_characters_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_enum_with_escaped_characters_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_enum_with_escaped_characters_response_body_for_content_types/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_enum_with_escaped_characters_response_body_for_content_types/post/__init__.py new file mode 100644 index 00000000000..dd863e069b6 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_enum_with_escaped_characters_response_body_for_content_types/post/__init__.py @@ -0,0 +1,215 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 + + +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_enum_with_escaped_characters_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_enum_with_escaped_characters_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_enum_with_escaped_characters_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_enum_with_escaped_characters_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostEnumWithEscapedCharactersResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_enum_with_escaped_characters_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_enum_with_escaped_characters_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_enum_with_escaped_characters_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_enum_with_escaped_characters_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_enum_with_escaped_characters_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_enum_with_escaped_characters_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_enum_with_escaped_characters_response_body_for_content_types/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_enum_with_escaped_characters_response_body_for_content_types/post/__init__.pyi new file mode 100644 index 00000000000..3977f10a95a --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_enum_with_escaped_characters_response_body_for_content_types/post/__init__.pyi @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from . import response_for_200 + +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_enum_with_escaped_characters_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_enum_with_escaped_characters_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_enum_with_escaped_characters_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_enum_with_escaped_characters_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostEnumWithEscapedCharactersResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_enum_with_escaped_characters_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_enum_with_escaped_characters_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_enum_with_escaped_characters_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_enum_with_escaped_characters_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_enum_with_escaped_characters_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_enum_with_escaped_characters_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_enum_with_escaped_characters_response_body_for_content_types/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_enum_with_escaped_characters_response_body_for_content_types/post/response_for_200.py new file mode 100644 index 00000000000..c86ab458168 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_enum_with_escaped_characters_response_body_for_content_types/post/response_for_200.py @@ -0,0 +1,43 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.enum_with_escaped_characters import EnumWithEscapedCharacters + + +class BodySchemas: + # body schemas + application_json = EnumWithEscapedCharacters + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_enum_with_false_does_not_match0_response_body_for_content_types/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_enum_with_false_does_not_match0_response_body_for_content_types/post.py deleted file mode 100644 index 7b99febc2d9..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_enum_with_false_does_not_match0_response_body_for_content_types/post.py +++ /dev/null @@ -1,234 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.enum_with_false_does_not_match0 import EnumWithFalseDoesNotMatch0 - -from . import path - -SchemaFor200ResponseBodyApplicationJson = EnumWithFalseDoesNotMatch0 - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_status_code_to_response = { - '200': _response_for_200, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_enum_with_false_does_not_match0_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_enum_with_false_does_not_match0_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_enum_with_false_does_not_match0_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_enum_with_false_does_not_match0_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostEnumWithFalseDoesNotMatch0ResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_enum_with_false_does_not_match0_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_enum_with_false_does_not_match0_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_enum_with_false_does_not_match0_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_enum_with_false_does_not_match0_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_enum_with_false_does_not_match0_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_enum_with_false_does_not_match0_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_enum_with_false_does_not_match0_response_body_for_content_types/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_enum_with_false_does_not_match0_response_body_for_content_types/post.pyi deleted file mode 100644 index 6456036913a..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_enum_with_false_does_not_match0_response_body_for_content_types/post.pyi +++ /dev/null @@ -1,229 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.enum_with_false_does_not_match0 import EnumWithFalseDoesNotMatch0 - -SchemaFor200ResponseBodyApplicationJson = EnumWithFalseDoesNotMatch0 - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_enum_with_false_does_not_match0_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_enum_with_false_does_not_match0_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_enum_with_false_does_not_match0_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_enum_with_false_does_not_match0_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostEnumWithFalseDoesNotMatch0ResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_enum_with_false_does_not_match0_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_enum_with_false_does_not_match0_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_enum_with_false_does_not_match0_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_enum_with_false_does_not_match0_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_enum_with_false_does_not_match0_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_enum_with_false_does_not_match0_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_enum_with_false_does_not_match0_response_body_for_content_types/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_enum_with_false_does_not_match0_response_body_for_content_types/post/__init__.py new file mode 100644 index 00000000000..d05f121c31f --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_enum_with_false_does_not_match0_response_body_for_content_types/post/__init__.py @@ -0,0 +1,215 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 + + +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_enum_with_false_does_not_match0_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_enum_with_false_does_not_match0_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_enum_with_false_does_not_match0_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_enum_with_false_does_not_match0_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostEnumWithFalseDoesNotMatch0ResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_enum_with_false_does_not_match0_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_enum_with_false_does_not_match0_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_enum_with_false_does_not_match0_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_enum_with_false_does_not_match0_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_enum_with_false_does_not_match0_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_enum_with_false_does_not_match0_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_enum_with_false_does_not_match0_response_body_for_content_types/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_enum_with_false_does_not_match0_response_body_for_content_types/post/__init__.pyi new file mode 100644 index 00000000000..e7b641d360a --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_enum_with_false_does_not_match0_response_body_for_content_types/post/__init__.pyi @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from . import response_for_200 + +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_enum_with_false_does_not_match0_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_enum_with_false_does_not_match0_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_enum_with_false_does_not_match0_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_enum_with_false_does_not_match0_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostEnumWithFalseDoesNotMatch0ResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_enum_with_false_does_not_match0_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_enum_with_false_does_not_match0_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_enum_with_false_does_not_match0_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_enum_with_false_does_not_match0_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_enum_with_false_does_not_match0_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_enum_with_false_does_not_match0_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_enum_with_false_does_not_match0_response_body_for_content_types/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_enum_with_false_does_not_match0_response_body_for_content_types/post/response_for_200.py new file mode 100644 index 00000000000..27d14647061 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_enum_with_false_does_not_match0_response_body_for_content_types/post/response_for_200.py @@ -0,0 +1,43 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.enum_with_false_does_not_match0 import EnumWithFalseDoesNotMatch0 + + +class BodySchemas: + # body schemas + application_json = EnumWithFalseDoesNotMatch0 + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_enum_with_true_does_not_match1_response_body_for_content_types/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_enum_with_true_does_not_match1_response_body_for_content_types/post.py deleted file mode 100644 index bf9c1ba2b10..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_enum_with_true_does_not_match1_response_body_for_content_types/post.py +++ /dev/null @@ -1,234 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.enum_with_true_does_not_match1 import EnumWithTrueDoesNotMatch1 - -from . import path - -SchemaFor200ResponseBodyApplicationJson = EnumWithTrueDoesNotMatch1 - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_status_code_to_response = { - '200': _response_for_200, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_enum_with_true_does_not_match1_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_enum_with_true_does_not_match1_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_enum_with_true_does_not_match1_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_enum_with_true_does_not_match1_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostEnumWithTrueDoesNotMatch1ResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_enum_with_true_does_not_match1_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_enum_with_true_does_not_match1_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_enum_with_true_does_not_match1_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_enum_with_true_does_not_match1_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_enum_with_true_does_not_match1_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_enum_with_true_does_not_match1_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_enum_with_true_does_not_match1_response_body_for_content_types/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_enum_with_true_does_not_match1_response_body_for_content_types/post.pyi deleted file mode 100644 index 89feb1f1b64..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_enum_with_true_does_not_match1_response_body_for_content_types/post.pyi +++ /dev/null @@ -1,229 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.enum_with_true_does_not_match1 import EnumWithTrueDoesNotMatch1 - -SchemaFor200ResponseBodyApplicationJson = EnumWithTrueDoesNotMatch1 - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_enum_with_true_does_not_match1_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_enum_with_true_does_not_match1_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_enum_with_true_does_not_match1_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_enum_with_true_does_not_match1_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostEnumWithTrueDoesNotMatch1ResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_enum_with_true_does_not_match1_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_enum_with_true_does_not_match1_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_enum_with_true_does_not_match1_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_enum_with_true_does_not_match1_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_enum_with_true_does_not_match1_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_enum_with_true_does_not_match1_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_enum_with_true_does_not_match1_response_body_for_content_types/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_enum_with_true_does_not_match1_response_body_for_content_types/post/__init__.py new file mode 100644 index 00000000000..e82b0ba3426 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_enum_with_true_does_not_match1_response_body_for_content_types/post/__init__.py @@ -0,0 +1,215 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 + + +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_enum_with_true_does_not_match1_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_enum_with_true_does_not_match1_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_enum_with_true_does_not_match1_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_enum_with_true_does_not_match1_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostEnumWithTrueDoesNotMatch1ResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_enum_with_true_does_not_match1_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_enum_with_true_does_not_match1_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_enum_with_true_does_not_match1_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_enum_with_true_does_not_match1_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_enum_with_true_does_not_match1_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_enum_with_true_does_not_match1_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_enum_with_true_does_not_match1_response_body_for_content_types/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_enum_with_true_does_not_match1_response_body_for_content_types/post/__init__.pyi new file mode 100644 index 00000000000..012f3d166d5 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_enum_with_true_does_not_match1_response_body_for_content_types/post/__init__.pyi @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from . import response_for_200 + +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_enum_with_true_does_not_match1_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_enum_with_true_does_not_match1_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_enum_with_true_does_not_match1_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_enum_with_true_does_not_match1_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostEnumWithTrueDoesNotMatch1ResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_enum_with_true_does_not_match1_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_enum_with_true_does_not_match1_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_enum_with_true_does_not_match1_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_enum_with_true_does_not_match1_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_enum_with_true_does_not_match1_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_enum_with_true_does_not_match1_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_enum_with_true_does_not_match1_response_body_for_content_types/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_enum_with_true_does_not_match1_response_body_for_content_types/post/response_for_200.py new file mode 100644 index 00000000000..49239ad7a9f --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_enum_with_true_does_not_match1_response_body_for_content_types/post/response_for_200.py @@ -0,0 +1,43 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.enum_with_true_does_not_match1 import EnumWithTrueDoesNotMatch1 + + +class BodySchemas: + # body schemas + application_json = EnumWithTrueDoesNotMatch1 + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_enums_in_properties_response_body_for_content_types/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_enums_in_properties_response_body_for_content_types/post.py deleted file mode 100644 index 189a0b705df..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_enums_in_properties_response_body_for_content_types/post.py +++ /dev/null @@ -1,234 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.enums_in_properties import EnumsInProperties - -from . import path - -SchemaFor200ResponseBodyApplicationJson = EnumsInProperties - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_status_code_to_response = { - '200': _response_for_200, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_enums_in_properties_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_enums_in_properties_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_enums_in_properties_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_enums_in_properties_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostEnumsInPropertiesResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_enums_in_properties_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_enums_in_properties_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_enums_in_properties_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_enums_in_properties_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_enums_in_properties_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_enums_in_properties_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_enums_in_properties_response_body_for_content_types/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_enums_in_properties_response_body_for_content_types/post.pyi deleted file mode 100644 index 4a050af8446..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_enums_in_properties_response_body_for_content_types/post.pyi +++ /dev/null @@ -1,229 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.enums_in_properties import EnumsInProperties - -SchemaFor200ResponseBodyApplicationJson = EnumsInProperties - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_enums_in_properties_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_enums_in_properties_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_enums_in_properties_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_enums_in_properties_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostEnumsInPropertiesResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_enums_in_properties_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_enums_in_properties_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_enums_in_properties_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_enums_in_properties_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_enums_in_properties_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_enums_in_properties_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_enums_in_properties_response_body_for_content_types/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_enums_in_properties_response_body_for_content_types/post/__init__.py new file mode 100644 index 00000000000..96606292c21 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_enums_in_properties_response_body_for_content_types/post/__init__.py @@ -0,0 +1,215 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 + + +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_enums_in_properties_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_enums_in_properties_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_enums_in_properties_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_enums_in_properties_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostEnumsInPropertiesResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_enums_in_properties_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_enums_in_properties_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_enums_in_properties_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_enums_in_properties_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_enums_in_properties_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_enums_in_properties_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_enums_in_properties_response_body_for_content_types/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_enums_in_properties_response_body_for_content_types/post/__init__.pyi new file mode 100644 index 00000000000..79845c4913e --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_enums_in_properties_response_body_for_content_types/post/__init__.pyi @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from . import response_for_200 + +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_enums_in_properties_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_enums_in_properties_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_enums_in_properties_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_enums_in_properties_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostEnumsInPropertiesResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_enums_in_properties_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_enums_in_properties_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_enums_in_properties_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_enums_in_properties_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_enums_in_properties_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_enums_in_properties_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_enums_in_properties_response_body_for_content_types/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_enums_in_properties_response_body_for_content_types/post/response_for_200.py new file mode 100644 index 00000000000..f08800a887e --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_enums_in_properties_response_body_for_content_types/post/response_for_200.py @@ -0,0 +1,43 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.enums_in_properties import EnumsInProperties + + +class BodySchemas: + # body schemas + application_json = EnumsInProperties + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_forbidden_property_response_body_for_content_types/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_forbidden_property_response_body_for_content_types/post.py deleted file mode 100644 index e2b09aead36..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_forbidden_property_response_body_for_content_types/post.py +++ /dev/null @@ -1,234 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.forbidden_property import ForbiddenProperty - -from . import path - -SchemaFor200ResponseBodyApplicationJson = ForbiddenProperty - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_status_code_to_response = { - '200': _response_for_200, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_forbidden_property_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_forbidden_property_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_forbidden_property_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_forbidden_property_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostForbiddenPropertyResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_forbidden_property_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_forbidden_property_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_forbidden_property_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_forbidden_property_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_forbidden_property_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_forbidden_property_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_forbidden_property_response_body_for_content_types/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_forbidden_property_response_body_for_content_types/post.pyi deleted file mode 100644 index 1b146acdf45..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_forbidden_property_response_body_for_content_types/post.pyi +++ /dev/null @@ -1,229 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.forbidden_property import ForbiddenProperty - -SchemaFor200ResponseBodyApplicationJson = ForbiddenProperty - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_forbidden_property_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_forbidden_property_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_forbidden_property_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_forbidden_property_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostForbiddenPropertyResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_forbidden_property_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_forbidden_property_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_forbidden_property_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_forbidden_property_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_forbidden_property_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_forbidden_property_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_forbidden_property_response_body_for_content_types/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_forbidden_property_response_body_for_content_types/post/__init__.py new file mode 100644 index 00000000000..b0644761ed0 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_forbidden_property_response_body_for_content_types/post/__init__.py @@ -0,0 +1,215 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 + + +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_forbidden_property_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_forbidden_property_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_forbidden_property_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_forbidden_property_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostForbiddenPropertyResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_forbidden_property_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_forbidden_property_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_forbidden_property_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_forbidden_property_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_forbidden_property_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_forbidden_property_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_forbidden_property_response_body_for_content_types/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_forbidden_property_response_body_for_content_types/post/__init__.pyi new file mode 100644 index 00000000000..407df4f0079 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_forbidden_property_response_body_for_content_types/post/__init__.pyi @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from . import response_for_200 + +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_forbidden_property_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_forbidden_property_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_forbidden_property_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_forbidden_property_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostForbiddenPropertyResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_forbidden_property_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_forbidden_property_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_forbidden_property_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_forbidden_property_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_forbidden_property_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_forbidden_property_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_forbidden_property_response_body_for_content_types/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_forbidden_property_response_body_for_content_types/post/response_for_200.py new file mode 100644 index 00000000000..39eb94cb942 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_forbidden_property_response_body_for_content_types/post/response_for_200.py @@ -0,0 +1,43 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.forbidden_property import ForbiddenProperty + + +class BodySchemas: + # body schemas + application_json = ForbiddenProperty + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_hostname_format_response_body_for_content_types/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_hostname_format_response_body_for_content_types/post.py deleted file mode 100644 index 1eb11280971..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_hostname_format_response_body_for_content_types/post.py +++ /dev/null @@ -1,254 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from . import path - - - -class SchemaFor200ResponseBodyApplicationJson( - schemas.AnyTypeSchema, -): - - - class MetaOapg: - format = 'hostname' - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'SchemaFor200ResponseBodyApplicationJson': - return super().__new__( - cls, - *args, - _configuration=_configuration, - **kwargs, - ) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_status_code_to_response = { - '200': _response_for_200, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_hostname_format_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_hostname_format_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_hostname_format_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_hostname_format_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostHostnameFormatResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_hostname_format_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_hostname_format_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_hostname_format_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_hostname_format_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_hostname_format_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_hostname_format_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_hostname_format_response_body_for_content_types/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_hostname_format_response_body_for_content_types/post.pyi deleted file mode 100644 index 3695f168ccf..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_hostname_format_response_body_for_content_types/post.pyi +++ /dev/null @@ -1,249 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - - - -class SchemaFor200ResponseBodyApplicationJson( - schemas.AnyTypeSchema, -): - - - class MetaOapg: - format = 'hostname' - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'SchemaFor200ResponseBodyApplicationJson': - return super().__new__( - cls, - *args, - _configuration=_configuration, - **kwargs, - ) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_hostname_format_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_hostname_format_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_hostname_format_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_hostname_format_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostHostnameFormatResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_hostname_format_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_hostname_format_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_hostname_format_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_hostname_format_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_hostname_format_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_hostname_format_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_hostname_format_response_body_for_content_types/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_hostname_format_response_body_for_content_types/post/__init__.py new file mode 100644 index 00000000000..ad785ba02c0 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_hostname_format_response_body_for_content_types/post/__init__.py @@ -0,0 +1,215 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 + + +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_hostname_format_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_hostname_format_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_hostname_format_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_hostname_format_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostHostnameFormatResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_hostname_format_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_hostname_format_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_hostname_format_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_hostname_format_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_hostname_format_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_hostname_format_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_hostname_format_response_body_for_content_types/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_hostname_format_response_body_for_content_types/post/__init__.pyi new file mode 100644 index 00000000000..18992698968 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_hostname_format_response_body_for_content_types/post/__init__.pyi @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from . import response_for_200 + +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_hostname_format_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_hostname_format_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_hostname_format_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_hostname_format_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostHostnameFormatResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_hostname_format_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_hostname_format_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_hostname_format_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_hostname_format_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_hostname_format_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_hostname_format_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_hostname_format_response_body_for_content_types/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_hostname_format_response_body_for_content_types/post/response_for_200.py new file mode 100644 index 00000000000..e87e8a875e2 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_hostname_format_response_body_for_content_types/post/response_for_200.py @@ -0,0 +1,43 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.hostname_format import HostnameFormat + + +class BodySchemas: + # body schemas + application_json = HostnameFormat + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_integer_type_matches_integers_response_body_for_content_types/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_integer_type_matches_integers_response_body_for_content_types/post.py deleted file mode 100644 index 1ed8a0920d9..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_integer_type_matches_integers_response_body_for_content_types/post.py +++ /dev/null @@ -1,232 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from . import path - -SchemaFor200ResponseBodyApplicationJson = schemas.IntSchema - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_status_code_to_response = { - '200': _response_for_200, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_integer_type_matches_integers_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_integer_type_matches_integers_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_integer_type_matches_integers_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_integer_type_matches_integers_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostIntegerTypeMatchesIntegersResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_integer_type_matches_integers_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_integer_type_matches_integers_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_integer_type_matches_integers_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_integer_type_matches_integers_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_integer_type_matches_integers_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_integer_type_matches_integers_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_integer_type_matches_integers_response_body_for_content_types/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_integer_type_matches_integers_response_body_for_content_types/post.pyi deleted file mode 100644 index b00b5c5ec8d..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_integer_type_matches_integers_response_body_for_content_types/post.pyi +++ /dev/null @@ -1,227 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -SchemaFor200ResponseBodyApplicationJson = schemas.IntSchema - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_integer_type_matches_integers_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_integer_type_matches_integers_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_integer_type_matches_integers_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_integer_type_matches_integers_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostIntegerTypeMatchesIntegersResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_integer_type_matches_integers_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_integer_type_matches_integers_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_integer_type_matches_integers_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_integer_type_matches_integers_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_integer_type_matches_integers_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_integer_type_matches_integers_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_integer_type_matches_integers_response_body_for_content_types/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_integer_type_matches_integers_response_body_for_content_types/post/__init__.py new file mode 100644 index 00000000000..2081d2ee63d --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_integer_type_matches_integers_response_body_for_content_types/post/__init__.py @@ -0,0 +1,215 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 + + +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_integer_type_matches_integers_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_integer_type_matches_integers_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_integer_type_matches_integers_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_integer_type_matches_integers_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostIntegerTypeMatchesIntegersResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_integer_type_matches_integers_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_integer_type_matches_integers_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_integer_type_matches_integers_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_integer_type_matches_integers_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_integer_type_matches_integers_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_integer_type_matches_integers_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_integer_type_matches_integers_response_body_for_content_types/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_integer_type_matches_integers_response_body_for_content_types/post/__init__.pyi new file mode 100644 index 00000000000..9321b5dae92 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_integer_type_matches_integers_response_body_for_content_types/post/__init__.pyi @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from . import response_for_200 + +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_integer_type_matches_integers_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_integer_type_matches_integers_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_integer_type_matches_integers_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_integer_type_matches_integers_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostIntegerTypeMatchesIntegersResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_integer_type_matches_integers_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_integer_type_matches_integers_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_integer_type_matches_integers_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_integer_type_matches_integers_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_integer_type_matches_integers_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_integer_type_matches_integers_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_integer_type_matches_integers_response_body_for_content_types/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_integer_type_matches_integers_response_body_for_content_types/post/response_for_200.py new file mode 100644 index 00000000000..a1b6997aafd --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_integer_type_matches_integers_response_body_for_content_types/post/response_for_200.py @@ -0,0 +1,43 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.integer_type_matches_integers import IntegerTypeMatchesIntegers + + +class BodySchemas: + # body schemas + application_json = IntegerTypeMatchesIntegers + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_invalid_instance_should_not_raise_error_when_float_division_inf_response_body_for_content_types/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_invalid_instance_should_not_raise_error_when_float_division_inf_response_body_for_content_types/post.py deleted file mode 100644 index 6fe5816765a..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_invalid_instance_should_not_raise_error_when_float_division_inf_response_body_for_content_types/post.py +++ /dev/null @@ -1,234 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.invalid_instance_should_not_raise_error_when_float_division_inf import InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf - -from . import path - -SchemaFor200ResponseBodyApplicationJson = InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_status_code_to_response = { - '200': _response_for_200, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_invalid_instance_should_not_raise_error_when_float_division_inf_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_invalid_instance_should_not_raise_error_when_float_division_inf_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_invalid_instance_should_not_raise_error_when_float_division_inf_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_invalid_instance_should_not_raise_error_when_float_division_inf_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostInvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInfResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_invalid_instance_should_not_raise_error_when_float_division_inf_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_invalid_instance_should_not_raise_error_when_float_division_inf_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_invalid_instance_should_not_raise_error_when_float_division_inf_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_invalid_instance_should_not_raise_error_when_float_division_inf_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_invalid_instance_should_not_raise_error_when_float_division_inf_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_invalid_instance_should_not_raise_error_when_float_division_inf_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_invalid_instance_should_not_raise_error_when_float_division_inf_response_body_for_content_types/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_invalid_instance_should_not_raise_error_when_float_division_inf_response_body_for_content_types/post.pyi deleted file mode 100644 index d9e3618aad8..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_invalid_instance_should_not_raise_error_when_float_division_inf_response_body_for_content_types/post.pyi +++ /dev/null @@ -1,229 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.invalid_instance_should_not_raise_error_when_float_division_inf import InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf - -SchemaFor200ResponseBodyApplicationJson = InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_invalid_instance_should_not_raise_error_when_float_division_inf_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_invalid_instance_should_not_raise_error_when_float_division_inf_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_invalid_instance_should_not_raise_error_when_float_division_inf_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_invalid_instance_should_not_raise_error_when_float_division_inf_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostInvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInfResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_invalid_instance_should_not_raise_error_when_float_division_inf_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_invalid_instance_should_not_raise_error_when_float_division_inf_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_invalid_instance_should_not_raise_error_when_float_division_inf_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_invalid_instance_should_not_raise_error_when_float_division_inf_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_invalid_instance_should_not_raise_error_when_float_division_inf_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_invalid_instance_should_not_raise_error_when_float_division_inf_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_invalid_instance_should_not_raise_error_when_float_division_inf_response_body_for_content_types/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_invalid_instance_should_not_raise_error_when_float_division_inf_response_body_for_content_types/post/__init__.py new file mode 100644 index 00000000000..46171f4eaea --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_invalid_instance_should_not_raise_error_when_float_division_inf_response_body_for_content_types/post/__init__.py @@ -0,0 +1,215 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 + + +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_invalid_instance_should_not_raise_error_when_float_division_inf_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_invalid_instance_should_not_raise_error_when_float_division_inf_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_invalid_instance_should_not_raise_error_when_float_division_inf_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_invalid_instance_should_not_raise_error_when_float_division_inf_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostInvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInfResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_invalid_instance_should_not_raise_error_when_float_division_inf_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_invalid_instance_should_not_raise_error_when_float_division_inf_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_invalid_instance_should_not_raise_error_when_float_division_inf_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_invalid_instance_should_not_raise_error_when_float_division_inf_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_invalid_instance_should_not_raise_error_when_float_division_inf_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_invalid_instance_should_not_raise_error_when_float_division_inf_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_invalid_instance_should_not_raise_error_when_float_division_inf_response_body_for_content_types/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_invalid_instance_should_not_raise_error_when_float_division_inf_response_body_for_content_types/post/__init__.pyi new file mode 100644 index 00000000000..3247b40ef03 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_invalid_instance_should_not_raise_error_when_float_division_inf_response_body_for_content_types/post/__init__.pyi @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from . import response_for_200 + +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_invalid_instance_should_not_raise_error_when_float_division_inf_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_invalid_instance_should_not_raise_error_when_float_division_inf_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_invalid_instance_should_not_raise_error_when_float_division_inf_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_invalid_instance_should_not_raise_error_when_float_division_inf_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostInvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInfResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_invalid_instance_should_not_raise_error_when_float_division_inf_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_invalid_instance_should_not_raise_error_when_float_division_inf_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_invalid_instance_should_not_raise_error_when_float_division_inf_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_invalid_instance_should_not_raise_error_when_float_division_inf_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_invalid_instance_should_not_raise_error_when_float_division_inf_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_invalid_instance_should_not_raise_error_when_float_division_inf_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_invalid_instance_should_not_raise_error_when_float_division_inf_response_body_for_content_types/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_invalid_instance_should_not_raise_error_when_float_division_inf_response_body_for_content_types/post/response_for_200.py new file mode 100644 index 00000000000..3728fe1e8b9 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_invalid_instance_should_not_raise_error_when_float_division_inf_response_body_for_content_types/post/response_for_200.py @@ -0,0 +1,43 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.invalid_instance_should_not_raise_error_when_float_division_inf import InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf + + +class BodySchemas: + # body schemas + application_json = InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_invalid_string_value_for_default_response_body_for_content_types/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_invalid_string_value_for_default_response_body_for_content_types/post.py deleted file mode 100644 index 39b0069e770..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_invalid_string_value_for_default_response_body_for_content_types/post.py +++ /dev/null @@ -1,234 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.invalid_string_value_for_default import InvalidStringValueForDefault - -from . import path - -SchemaFor200ResponseBodyApplicationJson = InvalidStringValueForDefault - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_status_code_to_response = { - '200': _response_for_200, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_invalid_string_value_for_default_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_invalid_string_value_for_default_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_invalid_string_value_for_default_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_invalid_string_value_for_default_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostInvalidStringValueForDefaultResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_invalid_string_value_for_default_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_invalid_string_value_for_default_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_invalid_string_value_for_default_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_invalid_string_value_for_default_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_invalid_string_value_for_default_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_invalid_string_value_for_default_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_invalid_string_value_for_default_response_body_for_content_types/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_invalid_string_value_for_default_response_body_for_content_types/post.pyi deleted file mode 100644 index c568b3e1302..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_invalid_string_value_for_default_response_body_for_content_types/post.pyi +++ /dev/null @@ -1,229 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.invalid_string_value_for_default import InvalidStringValueForDefault - -SchemaFor200ResponseBodyApplicationJson = InvalidStringValueForDefault - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_invalid_string_value_for_default_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_invalid_string_value_for_default_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_invalid_string_value_for_default_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_invalid_string_value_for_default_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostInvalidStringValueForDefaultResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_invalid_string_value_for_default_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_invalid_string_value_for_default_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_invalid_string_value_for_default_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_invalid_string_value_for_default_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_invalid_string_value_for_default_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_invalid_string_value_for_default_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_invalid_string_value_for_default_response_body_for_content_types/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_invalid_string_value_for_default_response_body_for_content_types/post/__init__.py new file mode 100644 index 00000000000..86742b44379 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_invalid_string_value_for_default_response_body_for_content_types/post/__init__.py @@ -0,0 +1,215 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 + + +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_invalid_string_value_for_default_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_invalid_string_value_for_default_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_invalid_string_value_for_default_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_invalid_string_value_for_default_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostInvalidStringValueForDefaultResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_invalid_string_value_for_default_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_invalid_string_value_for_default_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_invalid_string_value_for_default_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_invalid_string_value_for_default_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_invalid_string_value_for_default_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_invalid_string_value_for_default_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_invalid_string_value_for_default_response_body_for_content_types/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_invalid_string_value_for_default_response_body_for_content_types/post/__init__.pyi new file mode 100644 index 00000000000..d4802e1cee8 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_invalid_string_value_for_default_response_body_for_content_types/post/__init__.pyi @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from . import response_for_200 + +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_invalid_string_value_for_default_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_invalid_string_value_for_default_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_invalid_string_value_for_default_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_invalid_string_value_for_default_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostInvalidStringValueForDefaultResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_invalid_string_value_for_default_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_invalid_string_value_for_default_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_invalid_string_value_for_default_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_invalid_string_value_for_default_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_invalid_string_value_for_default_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_invalid_string_value_for_default_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_invalid_string_value_for_default_response_body_for_content_types/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_invalid_string_value_for_default_response_body_for_content_types/post/response_for_200.py new file mode 100644 index 00000000000..9768c57d542 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_invalid_string_value_for_default_response_body_for_content_types/post/response_for_200.py @@ -0,0 +1,43 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.invalid_string_value_for_default import InvalidStringValueForDefault + + +class BodySchemas: + # body schemas + application_json = InvalidStringValueForDefault + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ipv4_format_response_body_for_content_types/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ipv4_format_response_body_for_content_types/post.py deleted file mode 100644 index deb135e6eb7..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ipv4_format_response_body_for_content_types/post.py +++ /dev/null @@ -1,254 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from . import path - - - -class SchemaFor200ResponseBodyApplicationJson( - schemas.AnyTypeSchema, -): - - - class MetaOapg: - format = 'ipv4' - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'SchemaFor200ResponseBodyApplicationJson': - return super().__new__( - cls, - *args, - _configuration=_configuration, - **kwargs, - ) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_status_code_to_response = { - '200': _response_for_200, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_ipv4_format_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_ipv4_format_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_ipv4_format_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_ipv4_format_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostIpv4FormatResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_ipv4_format_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_ipv4_format_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_ipv4_format_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_ipv4_format_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_ipv4_format_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_ipv4_format_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ipv4_format_response_body_for_content_types/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ipv4_format_response_body_for_content_types/post.pyi deleted file mode 100644 index 7c0f7f47cb8..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ipv4_format_response_body_for_content_types/post.pyi +++ /dev/null @@ -1,249 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - - - -class SchemaFor200ResponseBodyApplicationJson( - schemas.AnyTypeSchema, -): - - - class MetaOapg: - format = 'ipv4' - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'SchemaFor200ResponseBodyApplicationJson': - return super().__new__( - cls, - *args, - _configuration=_configuration, - **kwargs, - ) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_ipv4_format_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_ipv4_format_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_ipv4_format_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_ipv4_format_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostIpv4FormatResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_ipv4_format_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_ipv4_format_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_ipv4_format_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_ipv4_format_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_ipv4_format_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_ipv4_format_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ipv4_format_response_body_for_content_types/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ipv4_format_response_body_for_content_types/post/__init__.py new file mode 100644 index 00000000000..5a0a25ea428 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ipv4_format_response_body_for_content_types/post/__init__.py @@ -0,0 +1,215 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 + + +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_ipv4_format_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_ipv4_format_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_ipv4_format_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_ipv4_format_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostIpv4FormatResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_ipv4_format_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_ipv4_format_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_ipv4_format_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_ipv4_format_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_ipv4_format_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_ipv4_format_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ipv4_format_response_body_for_content_types/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ipv4_format_response_body_for_content_types/post/__init__.pyi new file mode 100644 index 00000000000..7149459b24e --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ipv4_format_response_body_for_content_types/post/__init__.pyi @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from . import response_for_200 + +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_ipv4_format_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_ipv4_format_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_ipv4_format_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_ipv4_format_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostIpv4FormatResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_ipv4_format_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_ipv4_format_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_ipv4_format_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_ipv4_format_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_ipv4_format_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_ipv4_format_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ipv4_format_response_body_for_content_types/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ipv4_format_response_body_for_content_types/post/response_for_200.py new file mode 100644 index 00000000000..29d1e63506b --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ipv4_format_response_body_for_content_types/post/response_for_200.py @@ -0,0 +1,43 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.ipv4_format import Ipv4Format + + +class BodySchemas: + # body schemas + application_json = Ipv4Format + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ipv6_format_response_body_for_content_types/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ipv6_format_response_body_for_content_types/post.py deleted file mode 100644 index 3aa10226b8d..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ipv6_format_response_body_for_content_types/post.py +++ /dev/null @@ -1,254 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from . import path - - - -class SchemaFor200ResponseBodyApplicationJson( - schemas.AnyTypeSchema, -): - - - class MetaOapg: - format = 'ipv6' - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'SchemaFor200ResponseBodyApplicationJson': - return super().__new__( - cls, - *args, - _configuration=_configuration, - **kwargs, - ) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_status_code_to_response = { - '200': _response_for_200, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_ipv6_format_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_ipv6_format_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_ipv6_format_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_ipv6_format_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostIpv6FormatResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_ipv6_format_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_ipv6_format_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_ipv6_format_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_ipv6_format_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_ipv6_format_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_ipv6_format_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ipv6_format_response_body_for_content_types/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ipv6_format_response_body_for_content_types/post.pyi deleted file mode 100644 index 54392bcfc37..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ipv6_format_response_body_for_content_types/post.pyi +++ /dev/null @@ -1,249 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - - - -class SchemaFor200ResponseBodyApplicationJson( - schemas.AnyTypeSchema, -): - - - class MetaOapg: - format = 'ipv6' - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'SchemaFor200ResponseBodyApplicationJson': - return super().__new__( - cls, - *args, - _configuration=_configuration, - **kwargs, - ) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_ipv6_format_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_ipv6_format_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_ipv6_format_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_ipv6_format_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostIpv6FormatResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_ipv6_format_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_ipv6_format_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_ipv6_format_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_ipv6_format_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_ipv6_format_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_ipv6_format_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ipv6_format_response_body_for_content_types/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ipv6_format_response_body_for_content_types/post/__init__.py new file mode 100644 index 00000000000..f38b1701f1b --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ipv6_format_response_body_for_content_types/post/__init__.py @@ -0,0 +1,215 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 + + +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_ipv6_format_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_ipv6_format_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_ipv6_format_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_ipv6_format_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostIpv6FormatResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_ipv6_format_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_ipv6_format_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_ipv6_format_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_ipv6_format_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_ipv6_format_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_ipv6_format_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ipv6_format_response_body_for_content_types/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ipv6_format_response_body_for_content_types/post/__init__.pyi new file mode 100644 index 00000000000..487636a5afa --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ipv6_format_response_body_for_content_types/post/__init__.pyi @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from . import response_for_200 + +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_ipv6_format_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_ipv6_format_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_ipv6_format_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_ipv6_format_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostIpv6FormatResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_ipv6_format_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_ipv6_format_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_ipv6_format_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_ipv6_format_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_ipv6_format_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_ipv6_format_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ipv6_format_response_body_for_content_types/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ipv6_format_response_body_for_content_types/post/response_for_200.py new file mode 100644 index 00000000000..4403c4eb95a --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ipv6_format_response_body_for_content_types/post/response_for_200.py @@ -0,0 +1,43 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.ipv6_format import Ipv6Format + + +class BodySchemas: + # body schemas + application_json = Ipv6Format + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_json_pointer_format_response_body_for_content_types/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_json_pointer_format_response_body_for_content_types/post.py deleted file mode 100644 index c50bd665461..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_json_pointer_format_response_body_for_content_types/post.py +++ /dev/null @@ -1,254 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from . import path - - - -class SchemaFor200ResponseBodyApplicationJson( - schemas.AnyTypeSchema, -): - - - class MetaOapg: - format = 'json-pointer' - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'SchemaFor200ResponseBodyApplicationJson': - return super().__new__( - cls, - *args, - _configuration=_configuration, - **kwargs, - ) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_status_code_to_response = { - '200': _response_for_200, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_json_pointer_format_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_json_pointer_format_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_json_pointer_format_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_json_pointer_format_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostJsonPointerFormatResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_json_pointer_format_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_json_pointer_format_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_json_pointer_format_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_json_pointer_format_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_json_pointer_format_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_json_pointer_format_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_json_pointer_format_response_body_for_content_types/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_json_pointer_format_response_body_for_content_types/post.pyi deleted file mode 100644 index 93604bb85ca..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_json_pointer_format_response_body_for_content_types/post.pyi +++ /dev/null @@ -1,249 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - - - -class SchemaFor200ResponseBodyApplicationJson( - schemas.AnyTypeSchema, -): - - - class MetaOapg: - format = 'json-pointer' - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'SchemaFor200ResponseBodyApplicationJson': - return super().__new__( - cls, - *args, - _configuration=_configuration, - **kwargs, - ) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_json_pointer_format_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_json_pointer_format_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_json_pointer_format_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_json_pointer_format_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostJsonPointerFormatResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_json_pointer_format_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_json_pointer_format_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_json_pointer_format_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_json_pointer_format_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_json_pointer_format_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_json_pointer_format_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_json_pointer_format_response_body_for_content_types/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_json_pointer_format_response_body_for_content_types/post/__init__.py new file mode 100644 index 00000000000..b0281ced9b4 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_json_pointer_format_response_body_for_content_types/post/__init__.py @@ -0,0 +1,215 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 + + +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_json_pointer_format_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_json_pointer_format_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_json_pointer_format_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_json_pointer_format_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostJsonPointerFormatResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_json_pointer_format_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_json_pointer_format_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_json_pointer_format_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_json_pointer_format_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_json_pointer_format_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_json_pointer_format_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_json_pointer_format_response_body_for_content_types/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_json_pointer_format_response_body_for_content_types/post/__init__.pyi new file mode 100644 index 00000000000..f755f8b4b7d --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_json_pointer_format_response_body_for_content_types/post/__init__.pyi @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from . import response_for_200 + +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_json_pointer_format_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_json_pointer_format_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_json_pointer_format_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_json_pointer_format_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostJsonPointerFormatResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_json_pointer_format_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_json_pointer_format_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_json_pointer_format_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_json_pointer_format_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_json_pointer_format_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_json_pointer_format_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_json_pointer_format_response_body_for_content_types/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_json_pointer_format_response_body_for_content_types/post/response_for_200.py new file mode 100644 index 00000000000..daf4085f843 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_json_pointer_format_response_body_for_content_types/post/response_for_200.py @@ -0,0 +1,43 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.json_pointer_format import JsonPointerFormat + + +class BodySchemas: + # body schemas + application_json = JsonPointerFormat + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_maximum_validation_response_body_for_content_types/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_maximum_validation_response_body_for_content_types/post.py deleted file mode 100644 index 51dcc488a82..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_maximum_validation_response_body_for_content_types/post.py +++ /dev/null @@ -1,234 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.maximum_validation import MaximumValidation - -from . import path - -SchemaFor200ResponseBodyApplicationJson = MaximumValidation - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_status_code_to_response = { - '200': _response_for_200, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_maximum_validation_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_maximum_validation_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_maximum_validation_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_maximum_validation_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostMaximumValidationResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_maximum_validation_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_maximum_validation_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_maximum_validation_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_maximum_validation_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_maximum_validation_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_maximum_validation_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_maximum_validation_response_body_for_content_types/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_maximum_validation_response_body_for_content_types/post.pyi deleted file mode 100644 index 38c1592d8b7..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_maximum_validation_response_body_for_content_types/post.pyi +++ /dev/null @@ -1,229 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.maximum_validation import MaximumValidation - -SchemaFor200ResponseBodyApplicationJson = MaximumValidation - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_maximum_validation_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_maximum_validation_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_maximum_validation_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_maximum_validation_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostMaximumValidationResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_maximum_validation_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_maximum_validation_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_maximum_validation_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_maximum_validation_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_maximum_validation_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_maximum_validation_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_maximum_validation_response_body_for_content_types/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_maximum_validation_response_body_for_content_types/post/__init__.py new file mode 100644 index 00000000000..6ae501cd243 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_maximum_validation_response_body_for_content_types/post/__init__.py @@ -0,0 +1,215 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 + + +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_maximum_validation_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_maximum_validation_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_maximum_validation_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_maximum_validation_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostMaximumValidationResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_maximum_validation_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_maximum_validation_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_maximum_validation_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_maximum_validation_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_maximum_validation_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_maximum_validation_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_maximum_validation_response_body_for_content_types/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_maximum_validation_response_body_for_content_types/post/__init__.pyi new file mode 100644 index 00000000000..93499d3f84e --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_maximum_validation_response_body_for_content_types/post/__init__.pyi @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from . import response_for_200 + +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_maximum_validation_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_maximum_validation_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_maximum_validation_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_maximum_validation_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostMaximumValidationResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_maximum_validation_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_maximum_validation_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_maximum_validation_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_maximum_validation_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_maximum_validation_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_maximum_validation_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_maximum_validation_response_body_for_content_types/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_maximum_validation_response_body_for_content_types/post/response_for_200.py new file mode 100644 index 00000000000..a1d2b1eacd8 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_maximum_validation_response_body_for_content_types/post/response_for_200.py @@ -0,0 +1,43 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.maximum_validation import MaximumValidation + + +class BodySchemas: + # body schemas + application_json = MaximumValidation + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_maximum_validation_with_unsigned_integer_response_body_for_content_types/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_maximum_validation_with_unsigned_integer_response_body_for_content_types/post.py deleted file mode 100644 index b17d7e4eb7a..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_maximum_validation_with_unsigned_integer_response_body_for_content_types/post.py +++ /dev/null @@ -1,234 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.maximum_validation_with_unsigned_integer import MaximumValidationWithUnsignedInteger - -from . import path - -SchemaFor200ResponseBodyApplicationJson = MaximumValidationWithUnsignedInteger - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_status_code_to_response = { - '200': _response_for_200, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_maximum_validation_with_unsigned_integer_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_maximum_validation_with_unsigned_integer_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_maximum_validation_with_unsigned_integer_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_maximum_validation_with_unsigned_integer_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostMaximumValidationWithUnsignedIntegerResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_maximum_validation_with_unsigned_integer_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_maximum_validation_with_unsigned_integer_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_maximum_validation_with_unsigned_integer_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_maximum_validation_with_unsigned_integer_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_maximum_validation_with_unsigned_integer_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_maximum_validation_with_unsigned_integer_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_maximum_validation_with_unsigned_integer_response_body_for_content_types/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_maximum_validation_with_unsigned_integer_response_body_for_content_types/post.pyi deleted file mode 100644 index 39239b266b2..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_maximum_validation_with_unsigned_integer_response_body_for_content_types/post.pyi +++ /dev/null @@ -1,229 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.maximum_validation_with_unsigned_integer import MaximumValidationWithUnsignedInteger - -SchemaFor200ResponseBodyApplicationJson = MaximumValidationWithUnsignedInteger - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_maximum_validation_with_unsigned_integer_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_maximum_validation_with_unsigned_integer_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_maximum_validation_with_unsigned_integer_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_maximum_validation_with_unsigned_integer_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostMaximumValidationWithUnsignedIntegerResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_maximum_validation_with_unsigned_integer_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_maximum_validation_with_unsigned_integer_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_maximum_validation_with_unsigned_integer_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_maximum_validation_with_unsigned_integer_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_maximum_validation_with_unsigned_integer_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_maximum_validation_with_unsigned_integer_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_maximum_validation_with_unsigned_integer_response_body_for_content_types/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_maximum_validation_with_unsigned_integer_response_body_for_content_types/post/__init__.py new file mode 100644 index 00000000000..7f39795e7d2 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_maximum_validation_with_unsigned_integer_response_body_for_content_types/post/__init__.py @@ -0,0 +1,215 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 + + +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_maximum_validation_with_unsigned_integer_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_maximum_validation_with_unsigned_integer_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_maximum_validation_with_unsigned_integer_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_maximum_validation_with_unsigned_integer_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostMaximumValidationWithUnsignedIntegerResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_maximum_validation_with_unsigned_integer_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_maximum_validation_with_unsigned_integer_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_maximum_validation_with_unsigned_integer_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_maximum_validation_with_unsigned_integer_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_maximum_validation_with_unsigned_integer_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_maximum_validation_with_unsigned_integer_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_maximum_validation_with_unsigned_integer_response_body_for_content_types/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_maximum_validation_with_unsigned_integer_response_body_for_content_types/post/__init__.pyi new file mode 100644 index 00000000000..9682ad835c6 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_maximum_validation_with_unsigned_integer_response_body_for_content_types/post/__init__.pyi @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from . import response_for_200 + +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_maximum_validation_with_unsigned_integer_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_maximum_validation_with_unsigned_integer_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_maximum_validation_with_unsigned_integer_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_maximum_validation_with_unsigned_integer_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostMaximumValidationWithUnsignedIntegerResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_maximum_validation_with_unsigned_integer_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_maximum_validation_with_unsigned_integer_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_maximum_validation_with_unsigned_integer_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_maximum_validation_with_unsigned_integer_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_maximum_validation_with_unsigned_integer_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_maximum_validation_with_unsigned_integer_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_maximum_validation_with_unsigned_integer_response_body_for_content_types/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_maximum_validation_with_unsigned_integer_response_body_for_content_types/post/response_for_200.py new file mode 100644 index 00000000000..34a4987f87b --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_maximum_validation_with_unsigned_integer_response_body_for_content_types/post/response_for_200.py @@ -0,0 +1,43 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.maximum_validation_with_unsigned_integer import MaximumValidationWithUnsignedInteger + + +class BodySchemas: + # body schemas + application_json = MaximumValidationWithUnsignedInteger + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_maxitems_validation_response_body_for_content_types/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_maxitems_validation_response_body_for_content_types/post.py deleted file mode 100644 index 131755c3710..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_maxitems_validation_response_body_for_content_types/post.py +++ /dev/null @@ -1,234 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.maxitems_validation import MaxitemsValidation - -from . import path - -SchemaFor200ResponseBodyApplicationJson = MaxitemsValidation - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_status_code_to_response = { - '200': _response_for_200, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_maxitems_validation_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_maxitems_validation_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_maxitems_validation_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_maxitems_validation_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostMaxitemsValidationResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_maxitems_validation_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_maxitems_validation_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_maxitems_validation_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_maxitems_validation_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_maxitems_validation_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_maxitems_validation_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_maxitems_validation_response_body_for_content_types/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_maxitems_validation_response_body_for_content_types/post.pyi deleted file mode 100644 index 4b232322037..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_maxitems_validation_response_body_for_content_types/post.pyi +++ /dev/null @@ -1,229 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.maxitems_validation import MaxitemsValidation - -SchemaFor200ResponseBodyApplicationJson = MaxitemsValidation - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_maxitems_validation_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_maxitems_validation_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_maxitems_validation_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_maxitems_validation_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostMaxitemsValidationResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_maxitems_validation_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_maxitems_validation_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_maxitems_validation_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_maxitems_validation_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_maxitems_validation_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_maxitems_validation_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_maxitems_validation_response_body_for_content_types/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_maxitems_validation_response_body_for_content_types/post/__init__.py new file mode 100644 index 00000000000..bec781ec9f3 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_maxitems_validation_response_body_for_content_types/post/__init__.py @@ -0,0 +1,215 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 + + +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_maxitems_validation_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_maxitems_validation_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_maxitems_validation_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_maxitems_validation_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostMaxitemsValidationResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_maxitems_validation_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_maxitems_validation_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_maxitems_validation_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_maxitems_validation_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_maxitems_validation_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_maxitems_validation_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_maxitems_validation_response_body_for_content_types/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_maxitems_validation_response_body_for_content_types/post/__init__.pyi new file mode 100644 index 00000000000..bdb75b3b037 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_maxitems_validation_response_body_for_content_types/post/__init__.pyi @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from . import response_for_200 + +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_maxitems_validation_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_maxitems_validation_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_maxitems_validation_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_maxitems_validation_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostMaxitemsValidationResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_maxitems_validation_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_maxitems_validation_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_maxitems_validation_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_maxitems_validation_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_maxitems_validation_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_maxitems_validation_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_maxitems_validation_response_body_for_content_types/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_maxitems_validation_response_body_for_content_types/post/response_for_200.py new file mode 100644 index 00000000000..18092a7c9ce --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_maxitems_validation_response_body_for_content_types/post/response_for_200.py @@ -0,0 +1,43 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.maxitems_validation import MaxitemsValidation + + +class BodySchemas: + # body schemas + application_json = MaxitemsValidation + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_maxlength_validation_response_body_for_content_types/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_maxlength_validation_response_body_for_content_types/post.py deleted file mode 100644 index 12c48c612be..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_maxlength_validation_response_body_for_content_types/post.py +++ /dev/null @@ -1,234 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.maxlength_validation import MaxlengthValidation - -from . import path - -SchemaFor200ResponseBodyApplicationJson = MaxlengthValidation - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_status_code_to_response = { - '200': _response_for_200, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_maxlength_validation_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_maxlength_validation_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_maxlength_validation_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_maxlength_validation_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostMaxlengthValidationResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_maxlength_validation_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_maxlength_validation_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_maxlength_validation_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_maxlength_validation_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_maxlength_validation_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_maxlength_validation_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_maxlength_validation_response_body_for_content_types/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_maxlength_validation_response_body_for_content_types/post.pyi deleted file mode 100644 index 67a49cfb35e..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_maxlength_validation_response_body_for_content_types/post.pyi +++ /dev/null @@ -1,229 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.maxlength_validation import MaxlengthValidation - -SchemaFor200ResponseBodyApplicationJson = MaxlengthValidation - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_maxlength_validation_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_maxlength_validation_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_maxlength_validation_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_maxlength_validation_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostMaxlengthValidationResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_maxlength_validation_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_maxlength_validation_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_maxlength_validation_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_maxlength_validation_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_maxlength_validation_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_maxlength_validation_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_maxlength_validation_response_body_for_content_types/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_maxlength_validation_response_body_for_content_types/post/__init__.py new file mode 100644 index 00000000000..77829651a56 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_maxlength_validation_response_body_for_content_types/post/__init__.py @@ -0,0 +1,215 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 + + +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_maxlength_validation_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_maxlength_validation_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_maxlength_validation_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_maxlength_validation_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostMaxlengthValidationResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_maxlength_validation_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_maxlength_validation_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_maxlength_validation_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_maxlength_validation_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_maxlength_validation_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_maxlength_validation_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_maxlength_validation_response_body_for_content_types/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_maxlength_validation_response_body_for_content_types/post/__init__.pyi new file mode 100644 index 00000000000..98380b44237 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_maxlength_validation_response_body_for_content_types/post/__init__.pyi @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from . import response_for_200 + +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_maxlength_validation_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_maxlength_validation_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_maxlength_validation_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_maxlength_validation_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostMaxlengthValidationResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_maxlength_validation_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_maxlength_validation_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_maxlength_validation_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_maxlength_validation_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_maxlength_validation_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_maxlength_validation_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_maxlength_validation_response_body_for_content_types/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_maxlength_validation_response_body_for_content_types/post/response_for_200.py new file mode 100644 index 00000000000..9d880ef4ad8 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_maxlength_validation_response_body_for_content_types/post/response_for_200.py @@ -0,0 +1,43 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.maxlength_validation import MaxlengthValidation + + +class BodySchemas: + # body schemas + application_json = MaxlengthValidation + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_maxproperties0_means_the_object_is_empty_response_body_for_content_types/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_maxproperties0_means_the_object_is_empty_response_body_for_content_types/post.py deleted file mode 100644 index fe39361d422..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_maxproperties0_means_the_object_is_empty_response_body_for_content_types/post.py +++ /dev/null @@ -1,234 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.maxproperties0_means_the_object_is_empty import Maxproperties0MeansTheObjectIsEmpty - -from . import path - -SchemaFor200ResponseBodyApplicationJson = Maxproperties0MeansTheObjectIsEmpty - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_status_code_to_response = { - '200': _response_for_200, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_maxproperties0_means_the_object_is_empty_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_maxproperties0_means_the_object_is_empty_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_maxproperties0_means_the_object_is_empty_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_maxproperties0_means_the_object_is_empty_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostMaxproperties0MeansTheObjectIsEmptyResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_maxproperties0_means_the_object_is_empty_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_maxproperties0_means_the_object_is_empty_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_maxproperties0_means_the_object_is_empty_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_maxproperties0_means_the_object_is_empty_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_maxproperties0_means_the_object_is_empty_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_maxproperties0_means_the_object_is_empty_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_maxproperties0_means_the_object_is_empty_response_body_for_content_types/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_maxproperties0_means_the_object_is_empty_response_body_for_content_types/post.pyi deleted file mode 100644 index 816491bd56c..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_maxproperties0_means_the_object_is_empty_response_body_for_content_types/post.pyi +++ /dev/null @@ -1,229 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.maxproperties0_means_the_object_is_empty import Maxproperties0MeansTheObjectIsEmpty - -SchemaFor200ResponseBodyApplicationJson = Maxproperties0MeansTheObjectIsEmpty - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_maxproperties0_means_the_object_is_empty_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_maxproperties0_means_the_object_is_empty_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_maxproperties0_means_the_object_is_empty_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_maxproperties0_means_the_object_is_empty_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostMaxproperties0MeansTheObjectIsEmptyResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_maxproperties0_means_the_object_is_empty_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_maxproperties0_means_the_object_is_empty_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_maxproperties0_means_the_object_is_empty_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_maxproperties0_means_the_object_is_empty_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_maxproperties0_means_the_object_is_empty_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_maxproperties0_means_the_object_is_empty_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_maxproperties0_means_the_object_is_empty_response_body_for_content_types/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_maxproperties0_means_the_object_is_empty_response_body_for_content_types/post/__init__.py new file mode 100644 index 00000000000..68b8084dd24 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_maxproperties0_means_the_object_is_empty_response_body_for_content_types/post/__init__.py @@ -0,0 +1,215 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 + + +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_maxproperties0_means_the_object_is_empty_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_maxproperties0_means_the_object_is_empty_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_maxproperties0_means_the_object_is_empty_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_maxproperties0_means_the_object_is_empty_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostMaxproperties0MeansTheObjectIsEmptyResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_maxproperties0_means_the_object_is_empty_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_maxproperties0_means_the_object_is_empty_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_maxproperties0_means_the_object_is_empty_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_maxproperties0_means_the_object_is_empty_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_maxproperties0_means_the_object_is_empty_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_maxproperties0_means_the_object_is_empty_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_maxproperties0_means_the_object_is_empty_response_body_for_content_types/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_maxproperties0_means_the_object_is_empty_response_body_for_content_types/post/__init__.pyi new file mode 100644 index 00000000000..4b7b9ece740 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_maxproperties0_means_the_object_is_empty_response_body_for_content_types/post/__init__.pyi @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from . import response_for_200 + +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_maxproperties0_means_the_object_is_empty_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_maxproperties0_means_the_object_is_empty_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_maxproperties0_means_the_object_is_empty_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_maxproperties0_means_the_object_is_empty_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostMaxproperties0MeansTheObjectIsEmptyResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_maxproperties0_means_the_object_is_empty_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_maxproperties0_means_the_object_is_empty_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_maxproperties0_means_the_object_is_empty_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_maxproperties0_means_the_object_is_empty_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_maxproperties0_means_the_object_is_empty_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_maxproperties0_means_the_object_is_empty_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_maxproperties0_means_the_object_is_empty_response_body_for_content_types/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_maxproperties0_means_the_object_is_empty_response_body_for_content_types/post/response_for_200.py new file mode 100644 index 00000000000..0f43da30405 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_maxproperties0_means_the_object_is_empty_response_body_for_content_types/post/response_for_200.py @@ -0,0 +1,43 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.maxproperties0_means_the_object_is_empty import Maxproperties0MeansTheObjectIsEmpty + + +class BodySchemas: + # body schemas + application_json = Maxproperties0MeansTheObjectIsEmpty + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_maxproperties_validation_response_body_for_content_types/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_maxproperties_validation_response_body_for_content_types/post.py deleted file mode 100644 index 61ec66dfc04..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_maxproperties_validation_response_body_for_content_types/post.py +++ /dev/null @@ -1,234 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.maxproperties_validation import MaxpropertiesValidation - -from . import path - -SchemaFor200ResponseBodyApplicationJson = MaxpropertiesValidation - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_status_code_to_response = { - '200': _response_for_200, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_maxproperties_validation_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_maxproperties_validation_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_maxproperties_validation_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_maxproperties_validation_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostMaxpropertiesValidationResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_maxproperties_validation_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_maxproperties_validation_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_maxproperties_validation_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_maxproperties_validation_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_maxproperties_validation_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_maxproperties_validation_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_maxproperties_validation_response_body_for_content_types/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_maxproperties_validation_response_body_for_content_types/post.pyi deleted file mode 100644 index acad9a85a92..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_maxproperties_validation_response_body_for_content_types/post.pyi +++ /dev/null @@ -1,229 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.maxproperties_validation import MaxpropertiesValidation - -SchemaFor200ResponseBodyApplicationJson = MaxpropertiesValidation - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_maxproperties_validation_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_maxproperties_validation_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_maxproperties_validation_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_maxproperties_validation_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostMaxpropertiesValidationResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_maxproperties_validation_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_maxproperties_validation_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_maxproperties_validation_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_maxproperties_validation_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_maxproperties_validation_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_maxproperties_validation_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_maxproperties_validation_response_body_for_content_types/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_maxproperties_validation_response_body_for_content_types/post/__init__.py new file mode 100644 index 00000000000..97138d8b15a --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_maxproperties_validation_response_body_for_content_types/post/__init__.py @@ -0,0 +1,215 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 + + +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_maxproperties_validation_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_maxproperties_validation_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_maxproperties_validation_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_maxproperties_validation_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostMaxpropertiesValidationResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_maxproperties_validation_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_maxproperties_validation_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_maxproperties_validation_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_maxproperties_validation_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_maxproperties_validation_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_maxproperties_validation_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_maxproperties_validation_response_body_for_content_types/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_maxproperties_validation_response_body_for_content_types/post/__init__.pyi new file mode 100644 index 00000000000..02b03413fe3 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_maxproperties_validation_response_body_for_content_types/post/__init__.pyi @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from . import response_for_200 + +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_maxproperties_validation_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_maxproperties_validation_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_maxproperties_validation_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_maxproperties_validation_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostMaxpropertiesValidationResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_maxproperties_validation_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_maxproperties_validation_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_maxproperties_validation_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_maxproperties_validation_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_maxproperties_validation_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_maxproperties_validation_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_maxproperties_validation_response_body_for_content_types/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_maxproperties_validation_response_body_for_content_types/post/response_for_200.py new file mode 100644 index 00000000000..0e643c9eea2 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_maxproperties_validation_response_body_for_content_types/post/response_for_200.py @@ -0,0 +1,43 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.maxproperties_validation import MaxpropertiesValidation + + +class BodySchemas: + # body schemas + application_json = MaxpropertiesValidation + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_minimum_validation_response_body_for_content_types/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_minimum_validation_response_body_for_content_types/post.py deleted file mode 100644 index e6df6196f60..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_minimum_validation_response_body_for_content_types/post.py +++ /dev/null @@ -1,234 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.minimum_validation import MinimumValidation - -from . import path - -SchemaFor200ResponseBodyApplicationJson = MinimumValidation - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_status_code_to_response = { - '200': _response_for_200, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_minimum_validation_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_minimum_validation_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_minimum_validation_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_minimum_validation_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostMinimumValidationResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_minimum_validation_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_minimum_validation_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_minimum_validation_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_minimum_validation_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_minimum_validation_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_minimum_validation_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_minimum_validation_response_body_for_content_types/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_minimum_validation_response_body_for_content_types/post.pyi deleted file mode 100644 index 482781d5794..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_minimum_validation_response_body_for_content_types/post.pyi +++ /dev/null @@ -1,229 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.minimum_validation import MinimumValidation - -SchemaFor200ResponseBodyApplicationJson = MinimumValidation - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_minimum_validation_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_minimum_validation_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_minimum_validation_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_minimum_validation_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostMinimumValidationResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_minimum_validation_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_minimum_validation_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_minimum_validation_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_minimum_validation_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_minimum_validation_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_minimum_validation_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_minimum_validation_response_body_for_content_types/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_minimum_validation_response_body_for_content_types/post/__init__.py new file mode 100644 index 00000000000..26bfa07344a --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_minimum_validation_response_body_for_content_types/post/__init__.py @@ -0,0 +1,215 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 + + +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_minimum_validation_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_minimum_validation_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_minimum_validation_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_minimum_validation_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostMinimumValidationResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_minimum_validation_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_minimum_validation_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_minimum_validation_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_minimum_validation_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_minimum_validation_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_minimum_validation_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_minimum_validation_response_body_for_content_types/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_minimum_validation_response_body_for_content_types/post/__init__.pyi new file mode 100644 index 00000000000..db029ae1799 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_minimum_validation_response_body_for_content_types/post/__init__.pyi @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from . import response_for_200 + +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_minimum_validation_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_minimum_validation_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_minimum_validation_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_minimum_validation_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostMinimumValidationResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_minimum_validation_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_minimum_validation_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_minimum_validation_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_minimum_validation_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_minimum_validation_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_minimum_validation_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_minimum_validation_response_body_for_content_types/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_minimum_validation_response_body_for_content_types/post/response_for_200.py new file mode 100644 index 00000000000..8028e35ad19 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_minimum_validation_response_body_for_content_types/post/response_for_200.py @@ -0,0 +1,43 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.minimum_validation import MinimumValidation + + +class BodySchemas: + # body schemas + application_json = MinimumValidation + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_minimum_validation_with_signed_integer_response_body_for_content_types/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_minimum_validation_with_signed_integer_response_body_for_content_types/post.py deleted file mode 100644 index e929dbcee32..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_minimum_validation_with_signed_integer_response_body_for_content_types/post.py +++ /dev/null @@ -1,234 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.minimum_validation_with_signed_integer import MinimumValidationWithSignedInteger - -from . import path - -SchemaFor200ResponseBodyApplicationJson = MinimumValidationWithSignedInteger - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_status_code_to_response = { - '200': _response_for_200, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_minimum_validation_with_signed_integer_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_minimum_validation_with_signed_integer_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_minimum_validation_with_signed_integer_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_minimum_validation_with_signed_integer_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostMinimumValidationWithSignedIntegerResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_minimum_validation_with_signed_integer_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_minimum_validation_with_signed_integer_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_minimum_validation_with_signed_integer_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_minimum_validation_with_signed_integer_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_minimum_validation_with_signed_integer_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_minimum_validation_with_signed_integer_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_minimum_validation_with_signed_integer_response_body_for_content_types/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_minimum_validation_with_signed_integer_response_body_for_content_types/post.pyi deleted file mode 100644 index 850526fae3e..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_minimum_validation_with_signed_integer_response_body_for_content_types/post.pyi +++ /dev/null @@ -1,229 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.minimum_validation_with_signed_integer import MinimumValidationWithSignedInteger - -SchemaFor200ResponseBodyApplicationJson = MinimumValidationWithSignedInteger - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_minimum_validation_with_signed_integer_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_minimum_validation_with_signed_integer_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_minimum_validation_with_signed_integer_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_minimum_validation_with_signed_integer_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostMinimumValidationWithSignedIntegerResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_minimum_validation_with_signed_integer_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_minimum_validation_with_signed_integer_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_minimum_validation_with_signed_integer_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_minimum_validation_with_signed_integer_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_minimum_validation_with_signed_integer_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_minimum_validation_with_signed_integer_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_minimum_validation_with_signed_integer_response_body_for_content_types/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_minimum_validation_with_signed_integer_response_body_for_content_types/post/__init__.py new file mode 100644 index 00000000000..0bd7cc95e9e --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_minimum_validation_with_signed_integer_response_body_for_content_types/post/__init__.py @@ -0,0 +1,215 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 + + +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_minimum_validation_with_signed_integer_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_minimum_validation_with_signed_integer_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_minimum_validation_with_signed_integer_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_minimum_validation_with_signed_integer_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostMinimumValidationWithSignedIntegerResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_minimum_validation_with_signed_integer_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_minimum_validation_with_signed_integer_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_minimum_validation_with_signed_integer_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_minimum_validation_with_signed_integer_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_minimum_validation_with_signed_integer_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_minimum_validation_with_signed_integer_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_minimum_validation_with_signed_integer_response_body_for_content_types/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_minimum_validation_with_signed_integer_response_body_for_content_types/post/__init__.pyi new file mode 100644 index 00000000000..2a09a24e086 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_minimum_validation_with_signed_integer_response_body_for_content_types/post/__init__.pyi @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from . import response_for_200 + +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_minimum_validation_with_signed_integer_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_minimum_validation_with_signed_integer_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_minimum_validation_with_signed_integer_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_minimum_validation_with_signed_integer_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostMinimumValidationWithSignedIntegerResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_minimum_validation_with_signed_integer_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_minimum_validation_with_signed_integer_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_minimum_validation_with_signed_integer_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_minimum_validation_with_signed_integer_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_minimum_validation_with_signed_integer_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_minimum_validation_with_signed_integer_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_minimum_validation_with_signed_integer_response_body_for_content_types/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_minimum_validation_with_signed_integer_response_body_for_content_types/post/response_for_200.py new file mode 100644 index 00000000000..ba593909fa8 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_minimum_validation_with_signed_integer_response_body_for_content_types/post/response_for_200.py @@ -0,0 +1,43 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.minimum_validation_with_signed_integer import MinimumValidationWithSignedInteger + + +class BodySchemas: + # body schemas + application_json = MinimumValidationWithSignedInteger + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_minitems_validation_response_body_for_content_types/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_minitems_validation_response_body_for_content_types/post.py deleted file mode 100644 index df08580e42e..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_minitems_validation_response_body_for_content_types/post.py +++ /dev/null @@ -1,234 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.minitems_validation import MinitemsValidation - -from . import path - -SchemaFor200ResponseBodyApplicationJson = MinitemsValidation - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_status_code_to_response = { - '200': _response_for_200, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_minitems_validation_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_minitems_validation_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_minitems_validation_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_minitems_validation_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostMinitemsValidationResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_minitems_validation_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_minitems_validation_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_minitems_validation_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_minitems_validation_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_minitems_validation_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_minitems_validation_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_minitems_validation_response_body_for_content_types/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_minitems_validation_response_body_for_content_types/post.pyi deleted file mode 100644 index 73f91144425..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_minitems_validation_response_body_for_content_types/post.pyi +++ /dev/null @@ -1,229 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.minitems_validation import MinitemsValidation - -SchemaFor200ResponseBodyApplicationJson = MinitemsValidation - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_minitems_validation_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_minitems_validation_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_minitems_validation_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_minitems_validation_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostMinitemsValidationResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_minitems_validation_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_minitems_validation_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_minitems_validation_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_minitems_validation_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_minitems_validation_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_minitems_validation_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_minitems_validation_response_body_for_content_types/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_minitems_validation_response_body_for_content_types/post/__init__.py new file mode 100644 index 00000000000..72cd2a968c2 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_minitems_validation_response_body_for_content_types/post/__init__.py @@ -0,0 +1,215 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 + + +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_minitems_validation_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_minitems_validation_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_minitems_validation_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_minitems_validation_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostMinitemsValidationResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_minitems_validation_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_minitems_validation_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_minitems_validation_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_minitems_validation_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_minitems_validation_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_minitems_validation_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_minitems_validation_response_body_for_content_types/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_minitems_validation_response_body_for_content_types/post/__init__.pyi new file mode 100644 index 00000000000..4da47295913 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_minitems_validation_response_body_for_content_types/post/__init__.pyi @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from . import response_for_200 + +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_minitems_validation_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_minitems_validation_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_minitems_validation_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_minitems_validation_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostMinitemsValidationResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_minitems_validation_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_minitems_validation_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_minitems_validation_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_minitems_validation_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_minitems_validation_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_minitems_validation_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_minitems_validation_response_body_for_content_types/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_minitems_validation_response_body_for_content_types/post/response_for_200.py new file mode 100644 index 00000000000..be2e3095422 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_minitems_validation_response_body_for_content_types/post/response_for_200.py @@ -0,0 +1,43 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.minitems_validation import MinitemsValidation + + +class BodySchemas: + # body schemas + application_json = MinitemsValidation + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_minlength_validation_response_body_for_content_types/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_minlength_validation_response_body_for_content_types/post.py deleted file mode 100644 index df932cb5f10..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_minlength_validation_response_body_for_content_types/post.py +++ /dev/null @@ -1,234 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.minlength_validation import MinlengthValidation - -from . import path - -SchemaFor200ResponseBodyApplicationJson = MinlengthValidation - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_status_code_to_response = { - '200': _response_for_200, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_minlength_validation_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_minlength_validation_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_minlength_validation_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_minlength_validation_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostMinlengthValidationResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_minlength_validation_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_minlength_validation_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_minlength_validation_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_minlength_validation_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_minlength_validation_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_minlength_validation_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_minlength_validation_response_body_for_content_types/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_minlength_validation_response_body_for_content_types/post.pyi deleted file mode 100644 index 8779b7b9b11..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_minlength_validation_response_body_for_content_types/post.pyi +++ /dev/null @@ -1,229 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.minlength_validation import MinlengthValidation - -SchemaFor200ResponseBodyApplicationJson = MinlengthValidation - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_minlength_validation_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_minlength_validation_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_minlength_validation_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_minlength_validation_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostMinlengthValidationResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_minlength_validation_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_minlength_validation_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_minlength_validation_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_minlength_validation_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_minlength_validation_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_minlength_validation_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_minlength_validation_response_body_for_content_types/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_minlength_validation_response_body_for_content_types/post/__init__.py new file mode 100644 index 00000000000..9195e6b500d --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_minlength_validation_response_body_for_content_types/post/__init__.py @@ -0,0 +1,215 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 + + +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_minlength_validation_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_minlength_validation_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_minlength_validation_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_minlength_validation_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostMinlengthValidationResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_minlength_validation_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_minlength_validation_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_minlength_validation_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_minlength_validation_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_minlength_validation_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_minlength_validation_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_minlength_validation_response_body_for_content_types/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_minlength_validation_response_body_for_content_types/post/__init__.pyi new file mode 100644 index 00000000000..74d119e9727 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_minlength_validation_response_body_for_content_types/post/__init__.pyi @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from . import response_for_200 + +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_minlength_validation_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_minlength_validation_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_minlength_validation_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_minlength_validation_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostMinlengthValidationResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_minlength_validation_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_minlength_validation_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_minlength_validation_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_minlength_validation_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_minlength_validation_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_minlength_validation_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_minlength_validation_response_body_for_content_types/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_minlength_validation_response_body_for_content_types/post/response_for_200.py new file mode 100644 index 00000000000..39fa8c4323c --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_minlength_validation_response_body_for_content_types/post/response_for_200.py @@ -0,0 +1,43 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.minlength_validation import MinlengthValidation + + +class BodySchemas: + # body schemas + application_json = MinlengthValidation + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_minproperties_validation_response_body_for_content_types/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_minproperties_validation_response_body_for_content_types/post.py deleted file mode 100644 index fa20a29c541..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_minproperties_validation_response_body_for_content_types/post.py +++ /dev/null @@ -1,234 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.minproperties_validation import MinpropertiesValidation - -from . import path - -SchemaFor200ResponseBodyApplicationJson = MinpropertiesValidation - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_status_code_to_response = { - '200': _response_for_200, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_minproperties_validation_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_minproperties_validation_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_minproperties_validation_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_minproperties_validation_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostMinpropertiesValidationResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_minproperties_validation_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_minproperties_validation_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_minproperties_validation_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_minproperties_validation_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_minproperties_validation_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_minproperties_validation_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_minproperties_validation_response_body_for_content_types/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_minproperties_validation_response_body_for_content_types/post.pyi deleted file mode 100644 index 62b2572fd5a..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_minproperties_validation_response_body_for_content_types/post.pyi +++ /dev/null @@ -1,229 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.minproperties_validation import MinpropertiesValidation - -SchemaFor200ResponseBodyApplicationJson = MinpropertiesValidation - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_minproperties_validation_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_minproperties_validation_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_minproperties_validation_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_minproperties_validation_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostMinpropertiesValidationResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_minproperties_validation_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_minproperties_validation_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_minproperties_validation_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_minproperties_validation_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_minproperties_validation_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_minproperties_validation_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_minproperties_validation_response_body_for_content_types/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_minproperties_validation_response_body_for_content_types/post/__init__.py new file mode 100644 index 00000000000..5459c84bf5f --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_minproperties_validation_response_body_for_content_types/post/__init__.py @@ -0,0 +1,215 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 + + +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_minproperties_validation_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_minproperties_validation_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_minproperties_validation_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_minproperties_validation_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostMinpropertiesValidationResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_minproperties_validation_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_minproperties_validation_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_minproperties_validation_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_minproperties_validation_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_minproperties_validation_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_minproperties_validation_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_minproperties_validation_response_body_for_content_types/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_minproperties_validation_response_body_for_content_types/post/__init__.pyi new file mode 100644 index 00000000000..3cb5af39c1e --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_minproperties_validation_response_body_for_content_types/post/__init__.pyi @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from . import response_for_200 + +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_minproperties_validation_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_minproperties_validation_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_minproperties_validation_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_minproperties_validation_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostMinpropertiesValidationResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_minproperties_validation_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_minproperties_validation_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_minproperties_validation_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_minproperties_validation_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_minproperties_validation_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_minproperties_validation_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_minproperties_validation_response_body_for_content_types/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_minproperties_validation_response_body_for_content_types/post/response_for_200.py new file mode 100644 index 00000000000..0d78b189cec --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_minproperties_validation_response_body_for_content_types/post/response_for_200.py @@ -0,0 +1,43 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.minproperties_validation import MinpropertiesValidation + + +class BodySchemas: + # body schemas + application_json = MinpropertiesValidation + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_nested_allof_to_check_validation_semantics_response_body_for_content_types/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_nested_allof_to_check_validation_semantics_response_body_for_content_types/post.py deleted file mode 100644 index 373e7db540a..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_nested_allof_to_check_validation_semantics_response_body_for_content_types/post.py +++ /dev/null @@ -1,234 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.nested_allof_to_check_validation_semantics import NestedAllofToCheckValidationSemantics - -from . import path - -SchemaFor200ResponseBodyApplicationJson = NestedAllofToCheckValidationSemantics - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_status_code_to_response = { - '200': _response_for_200, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_nested_allof_to_check_validation_semantics_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_nested_allof_to_check_validation_semantics_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_nested_allof_to_check_validation_semantics_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_nested_allof_to_check_validation_semantics_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostNestedAllofToCheckValidationSemanticsResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_nested_allof_to_check_validation_semantics_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_nested_allof_to_check_validation_semantics_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_nested_allof_to_check_validation_semantics_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_nested_allof_to_check_validation_semantics_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_nested_allof_to_check_validation_semantics_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_nested_allof_to_check_validation_semantics_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_nested_allof_to_check_validation_semantics_response_body_for_content_types/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_nested_allof_to_check_validation_semantics_response_body_for_content_types/post.pyi deleted file mode 100644 index 99c4c8f7244..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_nested_allof_to_check_validation_semantics_response_body_for_content_types/post.pyi +++ /dev/null @@ -1,229 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.nested_allof_to_check_validation_semantics import NestedAllofToCheckValidationSemantics - -SchemaFor200ResponseBodyApplicationJson = NestedAllofToCheckValidationSemantics - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_nested_allof_to_check_validation_semantics_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_nested_allof_to_check_validation_semantics_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_nested_allof_to_check_validation_semantics_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_nested_allof_to_check_validation_semantics_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostNestedAllofToCheckValidationSemanticsResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_nested_allof_to_check_validation_semantics_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_nested_allof_to_check_validation_semantics_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_nested_allof_to_check_validation_semantics_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_nested_allof_to_check_validation_semantics_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_nested_allof_to_check_validation_semantics_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_nested_allof_to_check_validation_semantics_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_nested_allof_to_check_validation_semantics_response_body_for_content_types/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_nested_allof_to_check_validation_semantics_response_body_for_content_types/post/__init__.py new file mode 100644 index 00000000000..5a749a5e541 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_nested_allof_to_check_validation_semantics_response_body_for_content_types/post/__init__.py @@ -0,0 +1,215 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 + + +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_nested_allof_to_check_validation_semantics_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_nested_allof_to_check_validation_semantics_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_nested_allof_to_check_validation_semantics_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_nested_allof_to_check_validation_semantics_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostNestedAllofToCheckValidationSemanticsResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_nested_allof_to_check_validation_semantics_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_nested_allof_to_check_validation_semantics_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_nested_allof_to_check_validation_semantics_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_nested_allof_to_check_validation_semantics_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_nested_allof_to_check_validation_semantics_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_nested_allof_to_check_validation_semantics_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_nested_allof_to_check_validation_semantics_response_body_for_content_types/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_nested_allof_to_check_validation_semantics_response_body_for_content_types/post/__init__.pyi new file mode 100644 index 00000000000..f042209acc4 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_nested_allof_to_check_validation_semantics_response_body_for_content_types/post/__init__.pyi @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from . import response_for_200 + +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_nested_allof_to_check_validation_semantics_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_nested_allof_to_check_validation_semantics_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_nested_allof_to_check_validation_semantics_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_nested_allof_to_check_validation_semantics_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostNestedAllofToCheckValidationSemanticsResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_nested_allof_to_check_validation_semantics_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_nested_allof_to_check_validation_semantics_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_nested_allof_to_check_validation_semantics_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_nested_allof_to_check_validation_semantics_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_nested_allof_to_check_validation_semantics_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_nested_allof_to_check_validation_semantics_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_nested_allof_to_check_validation_semantics_response_body_for_content_types/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_nested_allof_to_check_validation_semantics_response_body_for_content_types/post/response_for_200.py new file mode 100644 index 00000000000..b5b6898c47e --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_nested_allof_to_check_validation_semantics_response_body_for_content_types/post/response_for_200.py @@ -0,0 +1,43 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.nested_allof_to_check_validation_semantics import NestedAllofToCheckValidationSemantics + + +class BodySchemas: + # body schemas + application_json = NestedAllofToCheckValidationSemantics + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_nested_anyof_to_check_validation_semantics_response_body_for_content_types/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_nested_anyof_to_check_validation_semantics_response_body_for_content_types/post.py deleted file mode 100644 index 94d61d9b79e..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_nested_anyof_to_check_validation_semantics_response_body_for_content_types/post.py +++ /dev/null @@ -1,234 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.nested_anyof_to_check_validation_semantics import NestedAnyofToCheckValidationSemantics - -from . import path - -SchemaFor200ResponseBodyApplicationJson = NestedAnyofToCheckValidationSemantics - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_status_code_to_response = { - '200': _response_for_200, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_nested_anyof_to_check_validation_semantics_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_nested_anyof_to_check_validation_semantics_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_nested_anyof_to_check_validation_semantics_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_nested_anyof_to_check_validation_semantics_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostNestedAnyofToCheckValidationSemanticsResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_nested_anyof_to_check_validation_semantics_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_nested_anyof_to_check_validation_semantics_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_nested_anyof_to_check_validation_semantics_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_nested_anyof_to_check_validation_semantics_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_nested_anyof_to_check_validation_semantics_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_nested_anyof_to_check_validation_semantics_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_nested_anyof_to_check_validation_semantics_response_body_for_content_types/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_nested_anyof_to_check_validation_semantics_response_body_for_content_types/post.pyi deleted file mode 100644 index 96c083c4b94..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_nested_anyof_to_check_validation_semantics_response_body_for_content_types/post.pyi +++ /dev/null @@ -1,229 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.nested_anyof_to_check_validation_semantics import NestedAnyofToCheckValidationSemantics - -SchemaFor200ResponseBodyApplicationJson = NestedAnyofToCheckValidationSemantics - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_nested_anyof_to_check_validation_semantics_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_nested_anyof_to_check_validation_semantics_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_nested_anyof_to_check_validation_semantics_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_nested_anyof_to_check_validation_semantics_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostNestedAnyofToCheckValidationSemanticsResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_nested_anyof_to_check_validation_semantics_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_nested_anyof_to_check_validation_semantics_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_nested_anyof_to_check_validation_semantics_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_nested_anyof_to_check_validation_semantics_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_nested_anyof_to_check_validation_semantics_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_nested_anyof_to_check_validation_semantics_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_nested_anyof_to_check_validation_semantics_response_body_for_content_types/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_nested_anyof_to_check_validation_semantics_response_body_for_content_types/post/__init__.py new file mode 100644 index 00000000000..946b1787677 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_nested_anyof_to_check_validation_semantics_response_body_for_content_types/post/__init__.py @@ -0,0 +1,215 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 + + +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_nested_anyof_to_check_validation_semantics_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_nested_anyof_to_check_validation_semantics_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_nested_anyof_to_check_validation_semantics_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_nested_anyof_to_check_validation_semantics_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostNestedAnyofToCheckValidationSemanticsResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_nested_anyof_to_check_validation_semantics_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_nested_anyof_to_check_validation_semantics_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_nested_anyof_to_check_validation_semantics_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_nested_anyof_to_check_validation_semantics_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_nested_anyof_to_check_validation_semantics_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_nested_anyof_to_check_validation_semantics_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_nested_anyof_to_check_validation_semantics_response_body_for_content_types/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_nested_anyof_to_check_validation_semantics_response_body_for_content_types/post/__init__.pyi new file mode 100644 index 00000000000..4c68f7e1b97 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_nested_anyof_to_check_validation_semantics_response_body_for_content_types/post/__init__.pyi @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from . import response_for_200 + +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_nested_anyof_to_check_validation_semantics_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_nested_anyof_to_check_validation_semantics_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_nested_anyof_to_check_validation_semantics_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_nested_anyof_to_check_validation_semantics_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostNestedAnyofToCheckValidationSemanticsResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_nested_anyof_to_check_validation_semantics_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_nested_anyof_to_check_validation_semantics_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_nested_anyof_to_check_validation_semantics_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_nested_anyof_to_check_validation_semantics_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_nested_anyof_to_check_validation_semantics_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_nested_anyof_to_check_validation_semantics_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_nested_anyof_to_check_validation_semantics_response_body_for_content_types/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_nested_anyof_to_check_validation_semantics_response_body_for_content_types/post/response_for_200.py new file mode 100644 index 00000000000..3a3b071ed9a --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_nested_anyof_to_check_validation_semantics_response_body_for_content_types/post/response_for_200.py @@ -0,0 +1,43 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.nested_anyof_to_check_validation_semantics import NestedAnyofToCheckValidationSemantics + + +class BodySchemas: + # body schemas + application_json = NestedAnyofToCheckValidationSemantics + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_nested_items_response_body_for_content_types/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_nested_items_response_body_for_content_types/post.py deleted file mode 100644 index 3bfe474ceba..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_nested_items_response_body_for_content_types/post.py +++ /dev/null @@ -1,234 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.nested_items import NestedItems - -from . import path - -SchemaFor200ResponseBodyApplicationJson = NestedItems - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_status_code_to_response = { - '200': _response_for_200, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_nested_items_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_nested_items_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_nested_items_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_nested_items_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostNestedItemsResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_nested_items_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_nested_items_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_nested_items_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_nested_items_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_nested_items_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_nested_items_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_nested_items_response_body_for_content_types/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_nested_items_response_body_for_content_types/post.pyi deleted file mode 100644 index 2869480c1d8..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_nested_items_response_body_for_content_types/post.pyi +++ /dev/null @@ -1,229 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.nested_items import NestedItems - -SchemaFor200ResponseBodyApplicationJson = NestedItems - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_nested_items_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_nested_items_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_nested_items_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_nested_items_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostNestedItemsResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_nested_items_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_nested_items_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_nested_items_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_nested_items_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_nested_items_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_nested_items_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_nested_items_response_body_for_content_types/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_nested_items_response_body_for_content_types/post/__init__.py new file mode 100644 index 00000000000..0c740cda726 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_nested_items_response_body_for_content_types/post/__init__.py @@ -0,0 +1,215 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 + + +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_nested_items_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_nested_items_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_nested_items_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_nested_items_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostNestedItemsResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_nested_items_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_nested_items_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_nested_items_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_nested_items_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_nested_items_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_nested_items_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_nested_items_response_body_for_content_types/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_nested_items_response_body_for_content_types/post/__init__.pyi new file mode 100644 index 00000000000..ada5dac70a1 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_nested_items_response_body_for_content_types/post/__init__.pyi @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from . import response_for_200 + +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_nested_items_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_nested_items_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_nested_items_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_nested_items_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostNestedItemsResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_nested_items_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_nested_items_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_nested_items_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_nested_items_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_nested_items_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_nested_items_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_nested_items_response_body_for_content_types/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_nested_items_response_body_for_content_types/post/response_for_200.py new file mode 100644 index 00000000000..c3ce3db671a --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_nested_items_response_body_for_content_types/post/response_for_200.py @@ -0,0 +1,43 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.nested_items import NestedItems + + +class BodySchemas: + # body schemas + application_json = NestedItems + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_nested_oneof_to_check_validation_semantics_response_body_for_content_types/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_nested_oneof_to_check_validation_semantics_response_body_for_content_types/post.py deleted file mode 100644 index 00dba053a14..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_nested_oneof_to_check_validation_semantics_response_body_for_content_types/post.py +++ /dev/null @@ -1,234 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.nested_oneof_to_check_validation_semantics import NestedOneofToCheckValidationSemantics - -from . import path - -SchemaFor200ResponseBodyApplicationJson = NestedOneofToCheckValidationSemantics - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_status_code_to_response = { - '200': _response_for_200, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_nested_oneof_to_check_validation_semantics_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_nested_oneof_to_check_validation_semantics_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_nested_oneof_to_check_validation_semantics_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_nested_oneof_to_check_validation_semantics_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostNestedOneofToCheckValidationSemanticsResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_nested_oneof_to_check_validation_semantics_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_nested_oneof_to_check_validation_semantics_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_nested_oneof_to_check_validation_semantics_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_nested_oneof_to_check_validation_semantics_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_nested_oneof_to_check_validation_semantics_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_nested_oneof_to_check_validation_semantics_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_nested_oneof_to_check_validation_semantics_response_body_for_content_types/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_nested_oneof_to_check_validation_semantics_response_body_for_content_types/post.pyi deleted file mode 100644 index 014f023fa6e..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_nested_oneof_to_check_validation_semantics_response_body_for_content_types/post.pyi +++ /dev/null @@ -1,229 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.nested_oneof_to_check_validation_semantics import NestedOneofToCheckValidationSemantics - -SchemaFor200ResponseBodyApplicationJson = NestedOneofToCheckValidationSemantics - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_nested_oneof_to_check_validation_semantics_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_nested_oneof_to_check_validation_semantics_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_nested_oneof_to_check_validation_semantics_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_nested_oneof_to_check_validation_semantics_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostNestedOneofToCheckValidationSemanticsResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_nested_oneof_to_check_validation_semantics_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_nested_oneof_to_check_validation_semantics_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_nested_oneof_to_check_validation_semantics_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_nested_oneof_to_check_validation_semantics_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_nested_oneof_to_check_validation_semantics_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_nested_oneof_to_check_validation_semantics_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_nested_oneof_to_check_validation_semantics_response_body_for_content_types/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_nested_oneof_to_check_validation_semantics_response_body_for_content_types/post/__init__.py new file mode 100644 index 00000000000..32c90a6893b --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_nested_oneof_to_check_validation_semantics_response_body_for_content_types/post/__init__.py @@ -0,0 +1,215 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 + + +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_nested_oneof_to_check_validation_semantics_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_nested_oneof_to_check_validation_semantics_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_nested_oneof_to_check_validation_semantics_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_nested_oneof_to_check_validation_semantics_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostNestedOneofToCheckValidationSemanticsResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_nested_oneof_to_check_validation_semantics_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_nested_oneof_to_check_validation_semantics_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_nested_oneof_to_check_validation_semantics_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_nested_oneof_to_check_validation_semantics_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_nested_oneof_to_check_validation_semantics_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_nested_oneof_to_check_validation_semantics_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_nested_oneof_to_check_validation_semantics_response_body_for_content_types/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_nested_oneof_to_check_validation_semantics_response_body_for_content_types/post/__init__.pyi new file mode 100644 index 00000000000..e693853fef0 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_nested_oneof_to_check_validation_semantics_response_body_for_content_types/post/__init__.pyi @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from . import response_for_200 + +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_nested_oneof_to_check_validation_semantics_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_nested_oneof_to_check_validation_semantics_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_nested_oneof_to_check_validation_semantics_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_nested_oneof_to_check_validation_semantics_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostNestedOneofToCheckValidationSemanticsResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_nested_oneof_to_check_validation_semantics_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_nested_oneof_to_check_validation_semantics_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_nested_oneof_to_check_validation_semantics_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_nested_oneof_to_check_validation_semantics_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_nested_oneof_to_check_validation_semantics_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_nested_oneof_to_check_validation_semantics_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_nested_oneof_to_check_validation_semantics_response_body_for_content_types/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_nested_oneof_to_check_validation_semantics_response_body_for_content_types/post/response_for_200.py new file mode 100644 index 00000000000..7a99cbe36d3 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_nested_oneof_to_check_validation_semantics_response_body_for_content_types/post/response_for_200.py @@ -0,0 +1,43 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.nested_oneof_to_check_validation_semantics import NestedOneofToCheckValidationSemantics + + +class BodySchemas: + # body schemas + application_json = NestedOneofToCheckValidationSemantics + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_not_more_complex_schema_response_body_for_content_types/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_not_more_complex_schema_response_body_for_content_types/post.py deleted file mode 100644 index 9cf3c05972a..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_not_more_complex_schema_response_body_for_content_types/post.py +++ /dev/null @@ -1,303 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from . import path - - - -class SchemaFor200ResponseBodyApplicationJson( - schemas.ComposedSchema, -): - - - class MetaOapg: - - - class not_schema( - schemas.DictSchema - ): - - - class MetaOapg: - - class properties: - foo = schemas.StrSchema - __annotations__ = { - "foo": foo, - } - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["foo"]) -> MetaOapg.properties.foo: ... - - @typing.overload - def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... - - def __getitem__(self, name: typing.Union[typing_extensions.Literal["foo", ], str]): - # dict_instance[name] accessor - return super().__getitem__(name) - - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["foo"]) -> typing.Union[MetaOapg.properties.foo, schemas.Unset]: ... - - @typing.overload - def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... - - def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["foo", ], str]): - return super().get_item_oapg(name) - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, ], - foo: typing.Union[MetaOapg.properties.foo, str, schemas.Unset] = schemas.unset, - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'not_schema': - return super().__new__( - cls, - *args, - foo=foo, - _configuration=_configuration, - **kwargs, - ) - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'SchemaFor200ResponseBodyApplicationJson': - return super().__new__( - cls, - *args, - _configuration=_configuration, - **kwargs, - ) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_status_code_to_response = { - '200': _response_for_200, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_not_more_complex_schema_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_not_more_complex_schema_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_not_more_complex_schema_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_not_more_complex_schema_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostNotMoreComplexSchemaResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_not_more_complex_schema_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_not_more_complex_schema_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_not_more_complex_schema_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_not_more_complex_schema_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_not_more_complex_schema_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_not_more_complex_schema_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_not_more_complex_schema_response_body_for_content_types/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_not_more_complex_schema_response_body_for_content_types/post.pyi deleted file mode 100644 index dba719e1352..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_not_more_complex_schema_response_body_for_content_types/post.pyi +++ /dev/null @@ -1,298 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - - - -class SchemaFor200ResponseBodyApplicationJson( - schemas.ComposedSchema, -): - - - class MetaOapg: - - - class not_schema( - schemas.DictSchema - ): - - - class MetaOapg: - - class properties: - foo = schemas.StrSchema - __annotations__ = { - "foo": foo, - } - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["foo"]) -> MetaOapg.properties.foo: ... - - @typing.overload - def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... - - def __getitem__(self, name: typing.Union[typing_extensions.Literal["foo", ], str]): - # dict_instance[name] accessor - return super().__getitem__(name) - - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["foo"]) -> typing.Union[MetaOapg.properties.foo, schemas.Unset]: ... - - @typing.overload - def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... - - def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["foo", ], str]): - return super().get_item_oapg(name) - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, ], - foo: typing.Union[MetaOapg.properties.foo, str, schemas.Unset] = schemas.unset, - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'not_schema': - return super().__new__( - cls, - *args, - foo=foo, - _configuration=_configuration, - **kwargs, - ) - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'SchemaFor200ResponseBodyApplicationJson': - return super().__new__( - cls, - *args, - _configuration=_configuration, - **kwargs, - ) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_not_more_complex_schema_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_not_more_complex_schema_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_not_more_complex_schema_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_not_more_complex_schema_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostNotMoreComplexSchemaResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_not_more_complex_schema_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_not_more_complex_schema_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_not_more_complex_schema_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_not_more_complex_schema_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_not_more_complex_schema_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_not_more_complex_schema_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_not_more_complex_schema_response_body_for_content_types/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_not_more_complex_schema_response_body_for_content_types/post/__init__.py new file mode 100644 index 00000000000..a24fafa9ee5 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_not_more_complex_schema_response_body_for_content_types/post/__init__.py @@ -0,0 +1,215 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 + + +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_not_more_complex_schema_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_not_more_complex_schema_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_not_more_complex_schema_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_not_more_complex_schema_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostNotMoreComplexSchemaResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_not_more_complex_schema_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_not_more_complex_schema_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_not_more_complex_schema_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_not_more_complex_schema_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_not_more_complex_schema_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_not_more_complex_schema_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_not_more_complex_schema_response_body_for_content_types/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_not_more_complex_schema_response_body_for_content_types/post/__init__.pyi new file mode 100644 index 00000000000..c478e5201be --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_not_more_complex_schema_response_body_for_content_types/post/__init__.pyi @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from . import response_for_200 + +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_not_more_complex_schema_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_not_more_complex_schema_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_not_more_complex_schema_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_not_more_complex_schema_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostNotMoreComplexSchemaResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_not_more_complex_schema_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_not_more_complex_schema_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_not_more_complex_schema_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_not_more_complex_schema_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_not_more_complex_schema_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_not_more_complex_schema_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_not_more_complex_schema_response_body_for_content_types/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_not_more_complex_schema_response_body_for_content_types/post/response_for_200.py new file mode 100644 index 00000000000..248d6d72dbe --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_not_more_complex_schema_response_body_for_content_types/post/response_for_200.py @@ -0,0 +1,43 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.not_more_complex_schema import NotMoreComplexSchema + + +class BodySchemas: + # body schemas + application_json = NotMoreComplexSchema + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_not_response_body_for_content_types/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_not_response_body_for_content_types/post.pyi deleted file mode 100644 index b3fc90331f3..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_not_response_body_for_content_types/post.pyi +++ /dev/null @@ -1,249 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - - - -class SchemaFor200ResponseBodyApplicationJson( - schemas.ComposedSchema, -): - - - class MetaOapg: - not_schema = schemas.IntSchema - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'SchemaFor200ResponseBodyApplicationJson': - return super().__new__( - cls, - *args, - _configuration=_configuration, - **kwargs, - ) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_not_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_not_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_not_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_not_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostNotResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_not_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_not_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_not_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_not_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_not_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_not_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_not_response_body_for_content_types/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_not_response_body_for_content_types/post/__init__.py new file mode 100644 index 00000000000..78bd4e83be7 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_not_response_body_for_content_types/post/__init__.py @@ -0,0 +1,215 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 + + +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_not_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_not_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_not_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_not_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostNotResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_not_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_not_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_not_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_not_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_not_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_not_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_not_response_body_for_content_types/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_not_response_body_for_content_types/post/__init__.pyi new file mode 100644 index 00000000000..ccc62c4f768 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_not_response_body_for_content_types/post/__init__.pyi @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from . import response_for_200 + +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_not_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_not_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_not_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_not_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostNotResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_not_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_not_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_not_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_not_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_not_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_not_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_not_response_body_for_content_types/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_not_response_body_for_content_types/post/response_for_200.py new file mode 100644 index 00000000000..9cd3f1d4d1e --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_not_response_body_for_content_types/post/response_for_200.py @@ -0,0 +1,43 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.model_not import ModelNot + + +class BodySchemas: + # body schemas + application_json = ModelNot + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_nul_characters_in_strings_response_body_for_content_types/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_nul_characters_in_strings_response_body_for_content_types/post.py deleted file mode 100644 index 51c0a38e329..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_nul_characters_in_strings_response_body_for_content_types/post.py +++ /dev/null @@ -1,234 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.nul_characters_in_strings import NulCharactersInStrings - -from . import path - -SchemaFor200ResponseBodyApplicationJson = NulCharactersInStrings - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_status_code_to_response = { - '200': _response_for_200, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_nul_characters_in_strings_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_nul_characters_in_strings_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_nul_characters_in_strings_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_nul_characters_in_strings_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostNulCharactersInStringsResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_nul_characters_in_strings_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_nul_characters_in_strings_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_nul_characters_in_strings_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_nul_characters_in_strings_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_nul_characters_in_strings_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_nul_characters_in_strings_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_nul_characters_in_strings_response_body_for_content_types/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_nul_characters_in_strings_response_body_for_content_types/post.pyi deleted file mode 100644 index fd0d333919d..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_nul_characters_in_strings_response_body_for_content_types/post.pyi +++ /dev/null @@ -1,229 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.nul_characters_in_strings import NulCharactersInStrings - -SchemaFor200ResponseBodyApplicationJson = NulCharactersInStrings - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_nul_characters_in_strings_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_nul_characters_in_strings_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_nul_characters_in_strings_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_nul_characters_in_strings_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostNulCharactersInStringsResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_nul_characters_in_strings_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_nul_characters_in_strings_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_nul_characters_in_strings_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_nul_characters_in_strings_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_nul_characters_in_strings_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_nul_characters_in_strings_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_nul_characters_in_strings_response_body_for_content_types/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_nul_characters_in_strings_response_body_for_content_types/post/__init__.py new file mode 100644 index 00000000000..6707748ee99 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_nul_characters_in_strings_response_body_for_content_types/post/__init__.py @@ -0,0 +1,215 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 + + +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_nul_characters_in_strings_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_nul_characters_in_strings_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_nul_characters_in_strings_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_nul_characters_in_strings_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostNulCharactersInStringsResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_nul_characters_in_strings_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_nul_characters_in_strings_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_nul_characters_in_strings_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_nul_characters_in_strings_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_nul_characters_in_strings_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_nul_characters_in_strings_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_nul_characters_in_strings_response_body_for_content_types/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_nul_characters_in_strings_response_body_for_content_types/post/__init__.pyi new file mode 100644 index 00000000000..29bd62b45e3 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_nul_characters_in_strings_response_body_for_content_types/post/__init__.pyi @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from . import response_for_200 + +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_nul_characters_in_strings_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_nul_characters_in_strings_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_nul_characters_in_strings_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_nul_characters_in_strings_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostNulCharactersInStringsResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_nul_characters_in_strings_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_nul_characters_in_strings_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_nul_characters_in_strings_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_nul_characters_in_strings_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_nul_characters_in_strings_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_nul_characters_in_strings_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_nul_characters_in_strings_response_body_for_content_types/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_nul_characters_in_strings_response_body_for_content_types/post/response_for_200.py new file mode 100644 index 00000000000..1603edd7cba --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_nul_characters_in_strings_response_body_for_content_types/post/response_for_200.py @@ -0,0 +1,43 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.nul_characters_in_strings import NulCharactersInStrings + + +class BodySchemas: + # body schemas + application_json = NulCharactersInStrings + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_null_type_matches_only_the_null_object_response_body_for_content_types/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_null_type_matches_only_the_null_object_response_body_for_content_types/post.py deleted file mode 100644 index c1e7d374a25..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_null_type_matches_only_the_null_object_response_body_for_content_types/post.py +++ /dev/null @@ -1,232 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from . import path - -SchemaFor200ResponseBodyApplicationJson = schemas.NoneSchema - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_status_code_to_response = { - '200': _response_for_200, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_null_type_matches_only_the_null_object_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_null_type_matches_only_the_null_object_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_null_type_matches_only_the_null_object_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_null_type_matches_only_the_null_object_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostNullTypeMatchesOnlyTheNullObjectResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_null_type_matches_only_the_null_object_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_null_type_matches_only_the_null_object_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_null_type_matches_only_the_null_object_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_null_type_matches_only_the_null_object_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_null_type_matches_only_the_null_object_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_null_type_matches_only_the_null_object_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_null_type_matches_only_the_null_object_response_body_for_content_types/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_null_type_matches_only_the_null_object_response_body_for_content_types/post.pyi deleted file mode 100644 index f8ec2c324da..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_null_type_matches_only_the_null_object_response_body_for_content_types/post.pyi +++ /dev/null @@ -1,227 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -SchemaFor200ResponseBodyApplicationJson = schemas.NoneSchema - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_null_type_matches_only_the_null_object_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_null_type_matches_only_the_null_object_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_null_type_matches_only_the_null_object_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_null_type_matches_only_the_null_object_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostNullTypeMatchesOnlyTheNullObjectResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_null_type_matches_only_the_null_object_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_null_type_matches_only_the_null_object_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_null_type_matches_only_the_null_object_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_null_type_matches_only_the_null_object_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_null_type_matches_only_the_null_object_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_null_type_matches_only_the_null_object_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_null_type_matches_only_the_null_object_response_body_for_content_types/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_null_type_matches_only_the_null_object_response_body_for_content_types/post/__init__.py new file mode 100644 index 00000000000..e23de2ad4d6 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_null_type_matches_only_the_null_object_response_body_for_content_types/post/__init__.py @@ -0,0 +1,215 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 + + +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_null_type_matches_only_the_null_object_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_null_type_matches_only_the_null_object_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_null_type_matches_only_the_null_object_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_null_type_matches_only_the_null_object_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostNullTypeMatchesOnlyTheNullObjectResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_null_type_matches_only_the_null_object_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_null_type_matches_only_the_null_object_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_null_type_matches_only_the_null_object_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_null_type_matches_only_the_null_object_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_null_type_matches_only_the_null_object_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_null_type_matches_only_the_null_object_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_null_type_matches_only_the_null_object_response_body_for_content_types/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_null_type_matches_only_the_null_object_response_body_for_content_types/post/__init__.pyi new file mode 100644 index 00000000000..322bf3e29c2 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_null_type_matches_only_the_null_object_response_body_for_content_types/post/__init__.pyi @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from . import response_for_200 + +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_null_type_matches_only_the_null_object_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_null_type_matches_only_the_null_object_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_null_type_matches_only_the_null_object_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_null_type_matches_only_the_null_object_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostNullTypeMatchesOnlyTheNullObjectResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_null_type_matches_only_the_null_object_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_null_type_matches_only_the_null_object_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_null_type_matches_only_the_null_object_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_null_type_matches_only_the_null_object_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_null_type_matches_only_the_null_object_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_null_type_matches_only_the_null_object_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_null_type_matches_only_the_null_object_response_body_for_content_types/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_null_type_matches_only_the_null_object_response_body_for_content_types/post/response_for_200.py new file mode 100644 index 00000000000..8832508e8d9 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_null_type_matches_only_the_null_object_response_body_for_content_types/post/response_for_200.py @@ -0,0 +1,43 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.null_type_matches_only_the_null_object import NullTypeMatchesOnlyTheNullObject + + +class BodySchemas: + # body schemas + application_json = NullTypeMatchesOnlyTheNullObject + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_number_type_matches_numbers_response_body_for_content_types/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_number_type_matches_numbers_response_body_for_content_types/post.py deleted file mode 100644 index 361775d9d41..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_number_type_matches_numbers_response_body_for_content_types/post.py +++ /dev/null @@ -1,232 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from . import path - -SchemaFor200ResponseBodyApplicationJson = schemas.NumberSchema - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_status_code_to_response = { - '200': _response_for_200, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_number_type_matches_numbers_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_number_type_matches_numbers_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_number_type_matches_numbers_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_number_type_matches_numbers_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostNumberTypeMatchesNumbersResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_number_type_matches_numbers_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_number_type_matches_numbers_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_number_type_matches_numbers_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_number_type_matches_numbers_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_number_type_matches_numbers_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_number_type_matches_numbers_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_number_type_matches_numbers_response_body_for_content_types/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_number_type_matches_numbers_response_body_for_content_types/post.pyi deleted file mode 100644 index 3c6fcf2bdb4..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_number_type_matches_numbers_response_body_for_content_types/post.pyi +++ /dev/null @@ -1,227 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -SchemaFor200ResponseBodyApplicationJson = schemas.NumberSchema - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_number_type_matches_numbers_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_number_type_matches_numbers_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_number_type_matches_numbers_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_number_type_matches_numbers_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostNumberTypeMatchesNumbersResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_number_type_matches_numbers_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_number_type_matches_numbers_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_number_type_matches_numbers_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_number_type_matches_numbers_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_number_type_matches_numbers_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_number_type_matches_numbers_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_number_type_matches_numbers_response_body_for_content_types/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_number_type_matches_numbers_response_body_for_content_types/post/__init__.py new file mode 100644 index 00000000000..fd54910c67a --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_number_type_matches_numbers_response_body_for_content_types/post/__init__.py @@ -0,0 +1,215 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 + + +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_number_type_matches_numbers_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_number_type_matches_numbers_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_number_type_matches_numbers_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_number_type_matches_numbers_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostNumberTypeMatchesNumbersResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_number_type_matches_numbers_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_number_type_matches_numbers_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_number_type_matches_numbers_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_number_type_matches_numbers_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_number_type_matches_numbers_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_number_type_matches_numbers_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_number_type_matches_numbers_response_body_for_content_types/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_number_type_matches_numbers_response_body_for_content_types/post/__init__.pyi new file mode 100644 index 00000000000..d45baabc56f --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_number_type_matches_numbers_response_body_for_content_types/post/__init__.pyi @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from . import response_for_200 + +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_number_type_matches_numbers_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_number_type_matches_numbers_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_number_type_matches_numbers_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_number_type_matches_numbers_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostNumberTypeMatchesNumbersResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_number_type_matches_numbers_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_number_type_matches_numbers_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_number_type_matches_numbers_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_number_type_matches_numbers_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_number_type_matches_numbers_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_number_type_matches_numbers_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_number_type_matches_numbers_response_body_for_content_types/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_number_type_matches_numbers_response_body_for_content_types/post/response_for_200.py new file mode 100644 index 00000000000..2d04802dfd3 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_number_type_matches_numbers_response_body_for_content_types/post/response_for_200.py @@ -0,0 +1,43 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.number_type_matches_numbers import NumberTypeMatchesNumbers + + +class BodySchemas: + # body schemas + application_json = NumberTypeMatchesNumbers + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_object_properties_validation_response_body_for_content_types/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_object_properties_validation_response_body_for_content_types/post.py deleted file mode 100644 index 4769ba021d8..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_object_properties_validation_response_body_for_content_types/post.py +++ /dev/null @@ -1,234 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.object_properties_validation import ObjectPropertiesValidation - -from . import path - -SchemaFor200ResponseBodyApplicationJson = ObjectPropertiesValidation - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_status_code_to_response = { - '200': _response_for_200, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_object_properties_validation_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_object_properties_validation_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_object_properties_validation_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_object_properties_validation_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostObjectPropertiesValidationResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_object_properties_validation_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_object_properties_validation_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_object_properties_validation_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_object_properties_validation_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_object_properties_validation_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_object_properties_validation_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_object_properties_validation_response_body_for_content_types/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_object_properties_validation_response_body_for_content_types/post.pyi deleted file mode 100644 index ba651953142..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_object_properties_validation_response_body_for_content_types/post.pyi +++ /dev/null @@ -1,229 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.object_properties_validation import ObjectPropertiesValidation - -SchemaFor200ResponseBodyApplicationJson = ObjectPropertiesValidation - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_object_properties_validation_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_object_properties_validation_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_object_properties_validation_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_object_properties_validation_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostObjectPropertiesValidationResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_object_properties_validation_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_object_properties_validation_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_object_properties_validation_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_object_properties_validation_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_object_properties_validation_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_object_properties_validation_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_object_properties_validation_response_body_for_content_types/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_object_properties_validation_response_body_for_content_types/post/__init__.py new file mode 100644 index 00000000000..ec10c929e9c --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_object_properties_validation_response_body_for_content_types/post/__init__.py @@ -0,0 +1,215 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 + + +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_object_properties_validation_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_object_properties_validation_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_object_properties_validation_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_object_properties_validation_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostObjectPropertiesValidationResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_object_properties_validation_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_object_properties_validation_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_object_properties_validation_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_object_properties_validation_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_object_properties_validation_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_object_properties_validation_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_object_properties_validation_response_body_for_content_types/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_object_properties_validation_response_body_for_content_types/post/__init__.pyi new file mode 100644 index 00000000000..8118d4d3e5f --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_object_properties_validation_response_body_for_content_types/post/__init__.pyi @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from . import response_for_200 + +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_object_properties_validation_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_object_properties_validation_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_object_properties_validation_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_object_properties_validation_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostObjectPropertiesValidationResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_object_properties_validation_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_object_properties_validation_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_object_properties_validation_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_object_properties_validation_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_object_properties_validation_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_object_properties_validation_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_object_properties_validation_response_body_for_content_types/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_object_properties_validation_response_body_for_content_types/post/response_for_200.py new file mode 100644 index 00000000000..8aa3746856c --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_object_properties_validation_response_body_for_content_types/post/response_for_200.py @@ -0,0 +1,43 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.object_properties_validation import ObjectPropertiesValidation + + +class BodySchemas: + # body schemas + application_json = ObjectPropertiesValidation + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_object_type_matches_objects_response_body_for_content_types/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_object_type_matches_objects_response_body_for_content_types/post.py deleted file mode 100644 index 40644049039..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_object_type_matches_objects_response_body_for_content_types/post.py +++ /dev/null @@ -1,232 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from . import path - -SchemaFor200ResponseBodyApplicationJson = schemas.DictSchema - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_status_code_to_response = { - '200': _response_for_200, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_object_type_matches_objects_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_object_type_matches_objects_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_object_type_matches_objects_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_object_type_matches_objects_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostObjectTypeMatchesObjectsResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_object_type_matches_objects_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_object_type_matches_objects_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_object_type_matches_objects_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_object_type_matches_objects_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_object_type_matches_objects_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_object_type_matches_objects_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_object_type_matches_objects_response_body_for_content_types/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_object_type_matches_objects_response_body_for_content_types/post.pyi deleted file mode 100644 index a536bf84d02..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_object_type_matches_objects_response_body_for_content_types/post.pyi +++ /dev/null @@ -1,227 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -SchemaFor200ResponseBodyApplicationJson = schemas.DictSchema - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_object_type_matches_objects_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_object_type_matches_objects_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_object_type_matches_objects_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_object_type_matches_objects_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostObjectTypeMatchesObjectsResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_object_type_matches_objects_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_object_type_matches_objects_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_object_type_matches_objects_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_object_type_matches_objects_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_object_type_matches_objects_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_object_type_matches_objects_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_object_type_matches_objects_response_body_for_content_types/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_object_type_matches_objects_response_body_for_content_types/post/__init__.py new file mode 100644 index 00000000000..f395ed5ec9a --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_object_type_matches_objects_response_body_for_content_types/post/__init__.py @@ -0,0 +1,215 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 + + +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_object_type_matches_objects_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_object_type_matches_objects_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_object_type_matches_objects_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_object_type_matches_objects_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostObjectTypeMatchesObjectsResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_object_type_matches_objects_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_object_type_matches_objects_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_object_type_matches_objects_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_object_type_matches_objects_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_object_type_matches_objects_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_object_type_matches_objects_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_object_type_matches_objects_response_body_for_content_types/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_object_type_matches_objects_response_body_for_content_types/post/__init__.pyi new file mode 100644 index 00000000000..25a89b7512c --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_object_type_matches_objects_response_body_for_content_types/post/__init__.pyi @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from . import response_for_200 + +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_object_type_matches_objects_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_object_type_matches_objects_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_object_type_matches_objects_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_object_type_matches_objects_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostObjectTypeMatchesObjectsResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_object_type_matches_objects_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_object_type_matches_objects_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_object_type_matches_objects_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_object_type_matches_objects_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_object_type_matches_objects_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_object_type_matches_objects_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_object_type_matches_objects_response_body_for_content_types/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_object_type_matches_objects_response_body_for_content_types/post/response_for_200.py new file mode 100644 index 00000000000..154b26cf30a --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_object_type_matches_objects_response_body_for_content_types/post/response_for_200.py @@ -0,0 +1,43 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.object_type_matches_objects import ObjectTypeMatchesObjects + + +class BodySchemas: + # body schemas + application_json = ObjectTypeMatchesObjects + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_oneof_complex_types_response_body_for_content_types/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_oneof_complex_types_response_body_for_content_types/post.py deleted file mode 100644 index ab4917e7cb1..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_oneof_complex_types_response_body_for_content_types/post.py +++ /dev/null @@ -1,234 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.oneof_complex_types import OneofComplexTypes - -from . import path - -SchemaFor200ResponseBodyApplicationJson = OneofComplexTypes - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_status_code_to_response = { - '200': _response_for_200, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_oneof_complex_types_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_oneof_complex_types_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_oneof_complex_types_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_oneof_complex_types_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostOneofComplexTypesResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_oneof_complex_types_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_oneof_complex_types_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_oneof_complex_types_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_oneof_complex_types_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_oneof_complex_types_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_oneof_complex_types_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_oneof_complex_types_response_body_for_content_types/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_oneof_complex_types_response_body_for_content_types/post.pyi deleted file mode 100644 index 13fc378b54c..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_oneof_complex_types_response_body_for_content_types/post.pyi +++ /dev/null @@ -1,229 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.oneof_complex_types import OneofComplexTypes - -SchemaFor200ResponseBodyApplicationJson = OneofComplexTypes - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_oneof_complex_types_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_oneof_complex_types_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_oneof_complex_types_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_oneof_complex_types_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostOneofComplexTypesResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_oneof_complex_types_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_oneof_complex_types_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_oneof_complex_types_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_oneof_complex_types_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_oneof_complex_types_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_oneof_complex_types_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_oneof_complex_types_response_body_for_content_types/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_oneof_complex_types_response_body_for_content_types/post/__init__.py new file mode 100644 index 00000000000..fa78cabae63 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_oneof_complex_types_response_body_for_content_types/post/__init__.py @@ -0,0 +1,215 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 + + +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_oneof_complex_types_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_oneof_complex_types_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_oneof_complex_types_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_oneof_complex_types_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostOneofComplexTypesResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_oneof_complex_types_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_oneof_complex_types_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_oneof_complex_types_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_oneof_complex_types_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_oneof_complex_types_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_oneof_complex_types_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_oneof_complex_types_response_body_for_content_types/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_oneof_complex_types_response_body_for_content_types/post/__init__.pyi new file mode 100644 index 00000000000..1342e3d8511 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_oneof_complex_types_response_body_for_content_types/post/__init__.pyi @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from . import response_for_200 + +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_oneof_complex_types_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_oneof_complex_types_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_oneof_complex_types_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_oneof_complex_types_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostOneofComplexTypesResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_oneof_complex_types_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_oneof_complex_types_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_oneof_complex_types_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_oneof_complex_types_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_oneof_complex_types_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_oneof_complex_types_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_oneof_complex_types_response_body_for_content_types/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_oneof_complex_types_response_body_for_content_types/post/response_for_200.py new file mode 100644 index 00000000000..30c5dd452e9 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_oneof_complex_types_response_body_for_content_types/post/response_for_200.py @@ -0,0 +1,43 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.oneof_complex_types import OneofComplexTypes + + +class BodySchemas: + # body schemas + application_json = OneofComplexTypes + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_oneof_response_body_for_content_types/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_oneof_response_body_for_content_types/post.py deleted file mode 100644 index a109b7c7af2..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_oneof_response_body_for_content_types/post.py +++ /dev/null @@ -1,234 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.oneof import Oneof - -from . import path - -SchemaFor200ResponseBodyApplicationJson = Oneof - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_status_code_to_response = { - '200': _response_for_200, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_oneof_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_oneof_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_oneof_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_oneof_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostOneofResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_oneof_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_oneof_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_oneof_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_oneof_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_oneof_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_oneof_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_oneof_response_body_for_content_types/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_oneof_response_body_for_content_types/post.pyi deleted file mode 100644 index 63bc2cb122f..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_oneof_response_body_for_content_types/post.pyi +++ /dev/null @@ -1,229 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.oneof import Oneof - -SchemaFor200ResponseBodyApplicationJson = Oneof - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_oneof_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_oneof_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_oneof_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_oneof_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostOneofResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_oneof_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_oneof_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_oneof_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_oneof_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_oneof_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_oneof_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_oneof_response_body_for_content_types/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_oneof_response_body_for_content_types/post/__init__.py new file mode 100644 index 00000000000..b2b3ab19bae --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_oneof_response_body_for_content_types/post/__init__.py @@ -0,0 +1,215 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 + + +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_oneof_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_oneof_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_oneof_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_oneof_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostOneofResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_oneof_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_oneof_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_oneof_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_oneof_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_oneof_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_oneof_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_oneof_response_body_for_content_types/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_oneof_response_body_for_content_types/post/__init__.pyi new file mode 100644 index 00000000000..3f96b36be1c --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_oneof_response_body_for_content_types/post/__init__.pyi @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from . import response_for_200 + +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_oneof_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_oneof_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_oneof_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_oneof_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostOneofResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_oneof_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_oneof_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_oneof_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_oneof_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_oneof_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_oneof_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_oneof_response_body_for_content_types/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_oneof_response_body_for_content_types/post/response_for_200.py new file mode 100644 index 00000000000..0b1f0868c17 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_oneof_response_body_for_content_types/post/response_for_200.py @@ -0,0 +1,43 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.oneof import Oneof + + +class BodySchemas: + # body schemas + application_json = Oneof + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_oneof_with_base_schema_response_body_for_content_types/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_oneof_with_base_schema_response_body_for_content_types/post.py deleted file mode 100644 index 1dfca4c3938..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_oneof_with_base_schema_response_body_for_content_types/post.py +++ /dev/null @@ -1,234 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.oneof_with_base_schema import OneofWithBaseSchema - -from . import path - -SchemaFor200ResponseBodyApplicationJson = OneofWithBaseSchema - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_status_code_to_response = { - '200': _response_for_200, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_oneof_with_base_schema_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_oneof_with_base_schema_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_oneof_with_base_schema_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_oneof_with_base_schema_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostOneofWithBaseSchemaResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_oneof_with_base_schema_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_oneof_with_base_schema_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_oneof_with_base_schema_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_oneof_with_base_schema_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_oneof_with_base_schema_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_oneof_with_base_schema_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_oneof_with_base_schema_response_body_for_content_types/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_oneof_with_base_schema_response_body_for_content_types/post.pyi deleted file mode 100644 index 086dd1a6e3d..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_oneof_with_base_schema_response_body_for_content_types/post.pyi +++ /dev/null @@ -1,229 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.oneof_with_base_schema import OneofWithBaseSchema - -SchemaFor200ResponseBodyApplicationJson = OneofWithBaseSchema - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_oneof_with_base_schema_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_oneof_with_base_schema_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_oneof_with_base_schema_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_oneof_with_base_schema_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostOneofWithBaseSchemaResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_oneof_with_base_schema_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_oneof_with_base_schema_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_oneof_with_base_schema_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_oneof_with_base_schema_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_oneof_with_base_schema_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_oneof_with_base_schema_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_oneof_with_base_schema_response_body_for_content_types/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_oneof_with_base_schema_response_body_for_content_types/post/__init__.py new file mode 100644 index 00000000000..ce1d60b49c4 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_oneof_with_base_schema_response_body_for_content_types/post/__init__.py @@ -0,0 +1,215 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 + + +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_oneof_with_base_schema_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_oneof_with_base_schema_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_oneof_with_base_schema_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_oneof_with_base_schema_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostOneofWithBaseSchemaResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_oneof_with_base_schema_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_oneof_with_base_schema_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_oneof_with_base_schema_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_oneof_with_base_schema_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_oneof_with_base_schema_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_oneof_with_base_schema_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_oneof_with_base_schema_response_body_for_content_types/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_oneof_with_base_schema_response_body_for_content_types/post/__init__.pyi new file mode 100644 index 00000000000..4f1cdc52ccb --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_oneof_with_base_schema_response_body_for_content_types/post/__init__.pyi @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from . import response_for_200 + +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_oneof_with_base_schema_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_oneof_with_base_schema_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_oneof_with_base_schema_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_oneof_with_base_schema_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostOneofWithBaseSchemaResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_oneof_with_base_schema_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_oneof_with_base_schema_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_oneof_with_base_schema_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_oneof_with_base_schema_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_oneof_with_base_schema_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_oneof_with_base_schema_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_oneof_with_base_schema_response_body_for_content_types/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_oneof_with_base_schema_response_body_for_content_types/post/response_for_200.py new file mode 100644 index 00000000000..9fcc30ebafe --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_oneof_with_base_schema_response_body_for_content_types/post/response_for_200.py @@ -0,0 +1,43 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.oneof_with_base_schema import OneofWithBaseSchema + + +class BodySchemas: + # body schemas + application_json = OneofWithBaseSchema + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_oneof_with_empty_schema_response_body_for_content_types/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_oneof_with_empty_schema_response_body_for_content_types/post.py deleted file mode 100644 index d91a02eeb70..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_oneof_with_empty_schema_response_body_for_content_types/post.py +++ /dev/null @@ -1,234 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.oneof_with_empty_schema import OneofWithEmptySchema - -from . import path - -SchemaFor200ResponseBodyApplicationJson = OneofWithEmptySchema - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_status_code_to_response = { - '200': _response_for_200, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_oneof_with_empty_schema_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_oneof_with_empty_schema_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_oneof_with_empty_schema_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_oneof_with_empty_schema_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostOneofWithEmptySchemaResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_oneof_with_empty_schema_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_oneof_with_empty_schema_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_oneof_with_empty_schema_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_oneof_with_empty_schema_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_oneof_with_empty_schema_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_oneof_with_empty_schema_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_oneof_with_empty_schema_response_body_for_content_types/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_oneof_with_empty_schema_response_body_for_content_types/post.pyi deleted file mode 100644 index db4e55b94fc..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_oneof_with_empty_schema_response_body_for_content_types/post.pyi +++ /dev/null @@ -1,229 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.oneof_with_empty_schema import OneofWithEmptySchema - -SchemaFor200ResponseBodyApplicationJson = OneofWithEmptySchema - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_oneof_with_empty_schema_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_oneof_with_empty_schema_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_oneof_with_empty_schema_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_oneof_with_empty_schema_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostOneofWithEmptySchemaResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_oneof_with_empty_schema_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_oneof_with_empty_schema_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_oneof_with_empty_schema_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_oneof_with_empty_schema_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_oneof_with_empty_schema_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_oneof_with_empty_schema_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_oneof_with_empty_schema_response_body_for_content_types/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_oneof_with_empty_schema_response_body_for_content_types/post/__init__.py new file mode 100644 index 00000000000..1dfbdfd82d5 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_oneof_with_empty_schema_response_body_for_content_types/post/__init__.py @@ -0,0 +1,215 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 + + +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_oneof_with_empty_schema_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_oneof_with_empty_schema_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_oneof_with_empty_schema_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_oneof_with_empty_schema_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostOneofWithEmptySchemaResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_oneof_with_empty_schema_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_oneof_with_empty_schema_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_oneof_with_empty_schema_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_oneof_with_empty_schema_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_oneof_with_empty_schema_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_oneof_with_empty_schema_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_oneof_with_empty_schema_response_body_for_content_types/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_oneof_with_empty_schema_response_body_for_content_types/post/__init__.pyi new file mode 100644 index 00000000000..b83e8145c4d --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_oneof_with_empty_schema_response_body_for_content_types/post/__init__.pyi @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from . import response_for_200 + +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_oneof_with_empty_schema_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_oneof_with_empty_schema_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_oneof_with_empty_schema_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_oneof_with_empty_schema_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostOneofWithEmptySchemaResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_oneof_with_empty_schema_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_oneof_with_empty_schema_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_oneof_with_empty_schema_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_oneof_with_empty_schema_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_oneof_with_empty_schema_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_oneof_with_empty_schema_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_oneof_with_empty_schema_response_body_for_content_types/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_oneof_with_empty_schema_response_body_for_content_types/post/response_for_200.py new file mode 100644 index 00000000000..5785cf33993 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_oneof_with_empty_schema_response_body_for_content_types/post/response_for_200.py @@ -0,0 +1,43 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.oneof_with_empty_schema import OneofWithEmptySchema + + +class BodySchemas: + # body schemas + application_json = OneofWithEmptySchema + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_oneof_with_required_response_body_for_content_types/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_oneof_with_required_response_body_for_content_types/post.py deleted file mode 100644 index 18af4cfe7b0..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_oneof_with_required_response_body_for_content_types/post.py +++ /dev/null @@ -1,234 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.oneof_with_required import OneofWithRequired - -from . import path - -SchemaFor200ResponseBodyApplicationJson = OneofWithRequired - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_status_code_to_response = { - '200': _response_for_200, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_oneof_with_required_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_oneof_with_required_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_oneof_with_required_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_oneof_with_required_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostOneofWithRequiredResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_oneof_with_required_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_oneof_with_required_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_oneof_with_required_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_oneof_with_required_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_oneof_with_required_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_oneof_with_required_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_oneof_with_required_response_body_for_content_types/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_oneof_with_required_response_body_for_content_types/post.pyi deleted file mode 100644 index f90b79612ce..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_oneof_with_required_response_body_for_content_types/post.pyi +++ /dev/null @@ -1,229 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.oneof_with_required import OneofWithRequired - -SchemaFor200ResponseBodyApplicationJson = OneofWithRequired - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_oneof_with_required_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_oneof_with_required_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_oneof_with_required_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_oneof_with_required_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostOneofWithRequiredResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_oneof_with_required_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_oneof_with_required_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_oneof_with_required_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_oneof_with_required_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_oneof_with_required_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_oneof_with_required_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_oneof_with_required_response_body_for_content_types/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_oneof_with_required_response_body_for_content_types/post/__init__.py new file mode 100644 index 00000000000..96f15d5c3ae --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_oneof_with_required_response_body_for_content_types/post/__init__.py @@ -0,0 +1,215 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 + + +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_oneof_with_required_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_oneof_with_required_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_oneof_with_required_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_oneof_with_required_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostOneofWithRequiredResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_oneof_with_required_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_oneof_with_required_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_oneof_with_required_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_oneof_with_required_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_oneof_with_required_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_oneof_with_required_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_oneof_with_required_response_body_for_content_types/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_oneof_with_required_response_body_for_content_types/post/__init__.pyi new file mode 100644 index 00000000000..dcb6c9f5f08 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_oneof_with_required_response_body_for_content_types/post/__init__.pyi @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from . import response_for_200 + +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_oneof_with_required_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_oneof_with_required_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_oneof_with_required_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_oneof_with_required_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostOneofWithRequiredResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_oneof_with_required_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_oneof_with_required_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_oneof_with_required_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_oneof_with_required_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_oneof_with_required_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_oneof_with_required_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_oneof_with_required_response_body_for_content_types/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_oneof_with_required_response_body_for_content_types/post/response_for_200.py new file mode 100644 index 00000000000..6471d18a272 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_oneof_with_required_response_body_for_content_types/post/response_for_200.py @@ -0,0 +1,43 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.oneof_with_required import OneofWithRequired + + +class BodySchemas: + # body schemas + application_json = OneofWithRequired + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_pattern_is_not_anchored_response_body_for_content_types/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_pattern_is_not_anchored_response_body_for_content_types/post.py deleted file mode 100644 index bef8879c1d6..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_pattern_is_not_anchored_response_body_for_content_types/post.py +++ /dev/null @@ -1,234 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.pattern_is_not_anchored import PatternIsNotAnchored - -from . import path - -SchemaFor200ResponseBodyApplicationJson = PatternIsNotAnchored - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_status_code_to_response = { - '200': _response_for_200, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_pattern_is_not_anchored_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_pattern_is_not_anchored_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_pattern_is_not_anchored_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_pattern_is_not_anchored_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostPatternIsNotAnchoredResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_pattern_is_not_anchored_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_pattern_is_not_anchored_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_pattern_is_not_anchored_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_pattern_is_not_anchored_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_pattern_is_not_anchored_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_pattern_is_not_anchored_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_pattern_is_not_anchored_response_body_for_content_types/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_pattern_is_not_anchored_response_body_for_content_types/post.pyi deleted file mode 100644 index c1cc91c88ca..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_pattern_is_not_anchored_response_body_for_content_types/post.pyi +++ /dev/null @@ -1,229 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.pattern_is_not_anchored import PatternIsNotAnchored - -SchemaFor200ResponseBodyApplicationJson = PatternIsNotAnchored - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_pattern_is_not_anchored_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_pattern_is_not_anchored_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_pattern_is_not_anchored_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_pattern_is_not_anchored_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostPatternIsNotAnchoredResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_pattern_is_not_anchored_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_pattern_is_not_anchored_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_pattern_is_not_anchored_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_pattern_is_not_anchored_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_pattern_is_not_anchored_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_pattern_is_not_anchored_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_pattern_is_not_anchored_response_body_for_content_types/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_pattern_is_not_anchored_response_body_for_content_types/post/__init__.py new file mode 100644 index 00000000000..1e80a4a80de --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_pattern_is_not_anchored_response_body_for_content_types/post/__init__.py @@ -0,0 +1,215 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 + + +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_pattern_is_not_anchored_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_pattern_is_not_anchored_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_pattern_is_not_anchored_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_pattern_is_not_anchored_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostPatternIsNotAnchoredResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_pattern_is_not_anchored_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_pattern_is_not_anchored_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_pattern_is_not_anchored_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_pattern_is_not_anchored_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_pattern_is_not_anchored_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_pattern_is_not_anchored_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_pattern_is_not_anchored_response_body_for_content_types/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_pattern_is_not_anchored_response_body_for_content_types/post/__init__.pyi new file mode 100644 index 00000000000..3bd8f574f49 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_pattern_is_not_anchored_response_body_for_content_types/post/__init__.pyi @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from . import response_for_200 + +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_pattern_is_not_anchored_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_pattern_is_not_anchored_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_pattern_is_not_anchored_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_pattern_is_not_anchored_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostPatternIsNotAnchoredResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_pattern_is_not_anchored_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_pattern_is_not_anchored_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_pattern_is_not_anchored_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_pattern_is_not_anchored_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_pattern_is_not_anchored_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_pattern_is_not_anchored_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_pattern_is_not_anchored_response_body_for_content_types/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_pattern_is_not_anchored_response_body_for_content_types/post/response_for_200.py new file mode 100644 index 00000000000..5c4258d4607 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_pattern_is_not_anchored_response_body_for_content_types/post/response_for_200.py @@ -0,0 +1,43 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.pattern_is_not_anchored import PatternIsNotAnchored + + +class BodySchemas: + # body schemas + application_json = PatternIsNotAnchored + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_pattern_validation_response_body_for_content_types/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_pattern_validation_response_body_for_content_types/post.py deleted file mode 100644 index f267935d147..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_pattern_validation_response_body_for_content_types/post.py +++ /dev/null @@ -1,234 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.pattern_validation import PatternValidation - -from . import path - -SchemaFor200ResponseBodyApplicationJson = PatternValidation - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_status_code_to_response = { - '200': _response_for_200, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_pattern_validation_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_pattern_validation_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_pattern_validation_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_pattern_validation_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostPatternValidationResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_pattern_validation_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_pattern_validation_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_pattern_validation_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_pattern_validation_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_pattern_validation_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_pattern_validation_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_pattern_validation_response_body_for_content_types/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_pattern_validation_response_body_for_content_types/post.pyi deleted file mode 100644 index 589121a113c..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_pattern_validation_response_body_for_content_types/post.pyi +++ /dev/null @@ -1,229 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.pattern_validation import PatternValidation - -SchemaFor200ResponseBodyApplicationJson = PatternValidation - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_pattern_validation_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_pattern_validation_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_pattern_validation_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_pattern_validation_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostPatternValidationResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_pattern_validation_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_pattern_validation_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_pattern_validation_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_pattern_validation_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_pattern_validation_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_pattern_validation_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_pattern_validation_response_body_for_content_types/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_pattern_validation_response_body_for_content_types/post/__init__.py new file mode 100644 index 00000000000..e4db0c0f0bd --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_pattern_validation_response_body_for_content_types/post/__init__.py @@ -0,0 +1,215 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 + + +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_pattern_validation_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_pattern_validation_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_pattern_validation_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_pattern_validation_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostPatternValidationResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_pattern_validation_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_pattern_validation_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_pattern_validation_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_pattern_validation_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_pattern_validation_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_pattern_validation_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_pattern_validation_response_body_for_content_types/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_pattern_validation_response_body_for_content_types/post/__init__.pyi new file mode 100644 index 00000000000..51e67b0d542 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_pattern_validation_response_body_for_content_types/post/__init__.pyi @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from . import response_for_200 + +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_pattern_validation_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_pattern_validation_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_pattern_validation_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_pattern_validation_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostPatternValidationResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_pattern_validation_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_pattern_validation_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_pattern_validation_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_pattern_validation_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_pattern_validation_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_pattern_validation_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_pattern_validation_response_body_for_content_types/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_pattern_validation_response_body_for_content_types/post/response_for_200.py new file mode 100644 index 00000000000..581d93e78cf --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_pattern_validation_response_body_for_content_types/post/response_for_200.py @@ -0,0 +1,43 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.pattern_validation import PatternValidation + + +class BodySchemas: + # body schemas + application_json = PatternValidation + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_properties_with_escaped_characters_response_body_for_content_types/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_properties_with_escaped_characters_response_body_for_content_types/post.py deleted file mode 100644 index 8bf1bdca885..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_properties_with_escaped_characters_response_body_for_content_types/post.py +++ /dev/null @@ -1,234 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.properties_with_escaped_characters import PropertiesWithEscapedCharacters - -from . import path - -SchemaFor200ResponseBodyApplicationJson = PropertiesWithEscapedCharacters - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_status_code_to_response = { - '200': _response_for_200, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_properties_with_escaped_characters_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_properties_with_escaped_characters_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_properties_with_escaped_characters_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_properties_with_escaped_characters_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostPropertiesWithEscapedCharactersResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_properties_with_escaped_characters_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_properties_with_escaped_characters_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_properties_with_escaped_characters_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_properties_with_escaped_characters_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_properties_with_escaped_characters_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_properties_with_escaped_characters_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_properties_with_escaped_characters_response_body_for_content_types/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_properties_with_escaped_characters_response_body_for_content_types/post.pyi deleted file mode 100644 index a2f57446fd3..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_properties_with_escaped_characters_response_body_for_content_types/post.pyi +++ /dev/null @@ -1,229 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.properties_with_escaped_characters import PropertiesWithEscapedCharacters - -SchemaFor200ResponseBodyApplicationJson = PropertiesWithEscapedCharacters - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_properties_with_escaped_characters_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_properties_with_escaped_characters_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_properties_with_escaped_characters_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_properties_with_escaped_characters_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostPropertiesWithEscapedCharactersResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_properties_with_escaped_characters_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_properties_with_escaped_characters_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_properties_with_escaped_characters_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_properties_with_escaped_characters_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_properties_with_escaped_characters_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_properties_with_escaped_characters_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_properties_with_escaped_characters_response_body_for_content_types/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_properties_with_escaped_characters_response_body_for_content_types/post/__init__.py new file mode 100644 index 00000000000..862395cbd3a --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_properties_with_escaped_characters_response_body_for_content_types/post/__init__.py @@ -0,0 +1,215 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 + + +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_properties_with_escaped_characters_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_properties_with_escaped_characters_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_properties_with_escaped_characters_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_properties_with_escaped_characters_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostPropertiesWithEscapedCharactersResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_properties_with_escaped_characters_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_properties_with_escaped_characters_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_properties_with_escaped_characters_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_properties_with_escaped_characters_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_properties_with_escaped_characters_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_properties_with_escaped_characters_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_properties_with_escaped_characters_response_body_for_content_types/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_properties_with_escaped_characters_response_body_for_content_types/post/__init__.pyi new file mode 100644 index 00000000000..ad47668bafd --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_properties_with_escaped_characters_response_body_for_content_types/post/__init__.pyi @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from . import response_for_200 + +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_properties_with_escaped_characters_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_properties_with_escaped_characters_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_properties_with_escaped_characters_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_properties_with_escaped_characters_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostPropertiesWithEscapedCharactersResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_properties_with_escaped_characters_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_properties_with_escaped_characters_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_properties_with_escaped_characters_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_properties_with_escaped_characters_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_properties_with_escaped_characters_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_properties_with_escaped_characters_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_properties_with_escaped_characters_response_body_for_content_types/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_properties_with_escaped_characters_response_body_for_content_types/post/response_for_200.py new file mode 100644 index 00000000000..7d00aa456f7 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_properties_with_escaped_characters_response_body_for_content_types/post/response_for_200.py @@ -0,0 +1,43 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.properties_with_escaped_characters import PropertiesWithEscapedCharacters + + +class BodySchemas: + # body schemas + application_json = PropertiesWithEscapedCharacters + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_property_named_ref_that_is_not_a_reference_response_body_for_content_types/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_property_named_ref_that_is_not_a_reference_response_body_for_content_types/post.py deleted file mode 100644 index 7bd5d81fe11..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_property_named_ref_that_is_not_a_reference_response_body_for_content_types/post.py +++ /dev/null @@ -1,234 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.property_named_ref_that_is_not_a_reference import PropertyNamedRefThatIsNotAReference - -from . import path - -SchemaFor200ResponseBodyApplicationJson = PropertyNamedRefThatIsNotAReference - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_status_code_to_response = { - '200': _response_for_200, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_property_named_ref_that_is_not_a_reference_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_property_named_ref_that_is_not_a_reference_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_property_named_ref_that_is_not_a_reference_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_property_named_ref_that_is_not_a_reference_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostPropertyNamedRefThatIsNotAReferenceResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_property_named_ref_that_is_not_a_reference_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_property_named_ref_that_is_not_a_reference_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_property_named_ref_that_is_not_a_reference_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_property_named_ref_that_is_not_a_reference_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_property_named_ref_that_is_not_a_reference_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_property_named_ref_that_is_not_a_reference_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_property_named_ref_that_is_not_a_reference_response_body_for_content_types/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_property_named_ref_that_is_not_a_reference_response_body_for_content_types/post.pyi deleted file mode 100644 index e6c1333f5c9..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_property_named_ref_that_is_not_a_reference_response_body_for_content_types/post.pyi +++ /dev/null @@ -1,229 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.property_named_ref_that_is_not_a_reference import PropertyNamedRefThatIsNotAReference - -SchemaFor200ResponseBodyApplicationJson = PropertyNamedRefThatIsNotAReference - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_property_named_ref_that_is_not_a_reference_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_property_named_ref_that_is_not_a_reference_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_property_named_ref_that_is_not_a_reference_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_property_named_ref_that_is_not_a_reference_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostPropertyNamedRefThatIsNotAReferenceResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_property_named_ref_that_is_not_a_reference_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_property_named_ref_that_is_not_a_reference_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_property_named_ref_that_is_not_a_reference_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_property_named_ref_that_is_not_a_reference_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_property_named_ref_that_is_not_a_reference_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_property_named_ref_that_is_not_a_reference_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_property_named_ref_that_is_not_a_reference_response_body_for_content_types/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_property_named_ref_that_is_not_a_reference_response_body_for_content_types/post/__init__.py new file mode 100644 index 00000000000..f25bd9a6d8a --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_property_named_ref_that_is_not_a_reference_response_body_for_content_types/post/__init__.py @@ -0,0 +1,215 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 + + +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_property_named_ref_that_is_not_a_reference_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_property_named_ref_that_is_not_a_reference_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_property_named_ref_that_is_not_a_reference_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_property_named_ref_that_is_not_a_reference_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostPropertyNamedRefThatIsNotAReferenceResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_property_named_ref_that_is_not_a_reference_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_property_named_ref_that_is_not_a_reference_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_property_named_ref_that_is_not_a_reference_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_property_named_ref_that_is_not_a_reference_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_property_named_ref_that_is_not_a_reference_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_property_named_ref_that_is_not_a_reference_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_property_named_ref_that_is_not_a_reference_response_body_for_content_types/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_property_named_ref_that_is_not_a_reference_response_body_for_content_types/post/__init__.pyi new file mode 100644 index 00000000000..75b36f86ab1 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_property_named_ref_that_is_not_a_reference_response_body_for_content_types/post/__init__.pyi @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from . import response_for_200 + +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_property_named_ref_that_is_not_a_reference_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_property_named_ref_that_is_not_a_reference_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_property_named_ref_that_is_not_a_reference_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_property_named_ref_that_is_not_a_reference_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostPropertyNamedRefThatIsNotAReferenceResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_property_named_ref_that_is_not_a_reference_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_property_named_ref_that_is_not_a_reference_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_property_named_ref_that_is_not_a_reference_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_property_named_ref_that_is_not_a_reference_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_property_named_ref_that_is_not_a_reference_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_property_named_ref_that_is_not_a_reference_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_property_named_ref_that_is_not_a_reference_response_body_for_content_types/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_property_named_ref_that_is_not_a_reference_response_body_for_content_types/post/response_for_200.py new file mode 100644 index 00000000000..d952359e473 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_property_named_ref_that_is_not_a_reference_response_body_for_content_types/post/response_for_200.py @@ -0,0 +1,43 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.property_named_ref_that_is_not_a_reference import PropertyNamedRefThatIsNotAReference + + +class BodySchemas: + # body schemas + application_json = PropertyNamedRefThatIsNotAReference + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ref_in_additionalproperties_response_body_for_content_types/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ref_in_additionalproperties_response_body_for_content_types/post.py deleted file mode 100644 index e7d5c5eca61..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ref_in_additionalproperties_response_body_for_content_types/post.py +++ /dev/null @@ -1,234 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.ref_in_additionalproperties import RefInAdditionalproperties - -from . import path - -SchemaFor200ResponseBodyApplicationJson = RefInAdditionalproperties - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_status_code_to_response = { - '200': _response_for_200, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_ref_in_additionalproperties_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_ref_in_additionalproperties_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_ref_in_additionalproperties_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_ref_in_additionalproperties_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostRefInAdditionalpropertiesResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_ref_in_additionalproperties_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_ref_in_additionalproperties_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_ref_in_additionalproperties_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_ref_in_additionalproperties_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_ref_in_additionalproperties_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_ref_in_additionalproperties_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ref_in_additionalproperties_response_body_for_content_types/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ref_in_additionalproperties_response_body_for_content_types/post.pyi deleted file mode 100644 index 0bb91ff44c1..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ref_in_additionalproperties_response_body_for_content_types/post.pyi +++ /dev/null @@ -1,229 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.ref_in_additionalproperties import RefInAdditionalproperties - -SchemaFor200ResponseBodyApplicationJson = RefInAdditionalproperties - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_ref_in_additionalproperties_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_ref_in_additionalproperties_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_ref_in_additionalproperties_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_ref_in_additionalproperties_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostRefInAdditionalpropertiesResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_ref_in_additionalproperties_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_ref_in_additionalproperties_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_ref_in_additionalproperties_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_ref_in_additionalproperties_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_ref_in_additionalproperties_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_ref_in_additionalproperties_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ref_in_additionalproperties_response_body_for_content_types/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ref_in_additionalproperties_response_body_for_content_types/post/__init__.py new file mode 100644 index 00000000000..9f3eded8a1d --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ref_in_additionalproperties_response_body_for_content_types/post/__init__.py @@ -0,0 +1,215 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 + + +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_ref_in_additionalproperties_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_ref_in_additionalproperties_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_ref_in_additionalproperties_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_ref_in_additionalproperties_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostRefInAdditionalpropertiesResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_ref_in_additionalproperties_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_ref_in_additionalproperties_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_ref_in_additionalproperties_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_ref_in_additionalproperties_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_ref_in_additionalproperties_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_ref_in_additionalproperties_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ref_in_additionalproperties_response_body_for_content_types/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ref_in_additionalproperties_response_body_for_content_types/post/__init__.pyi new file mode 100644 index 00000000000..a97f1340bb0 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ref_in_additionalproperties_response_body_for_content_types/post/__init__.pyi @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from . import response_for_200 + +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_ref_in_additionalproperties_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_ref_in_additionalproperties_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_ref_in_additionalproperties_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_ref_in_additionalproperties_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostRefInAdditionalpropertiesResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_ref_in_additionalproperties_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_ref_in_additionalproperties_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_ref_in_additionalproperties_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_ref_in_additionalproperties_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_ref_in_additionalproperties_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_ref_in_additionalproperties_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ref_in_additionalproperties_response_body_for_content_types/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ref_in_additionalproperties_response_body_for_content_types/post/response_for_200.py new file mode 100644 index 00000000000..1eff82b3ddc --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ref_in_additionalproperties_response_body_for_content_types/post/response_for_200.py @@ -0,0 +1,43 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.ref_in_additionalproperties import RefInAdditionalproperties + + +class BodySchemas: + # body schemas + application_json = RefInAdditionalproperties + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ref_in_allof_response_body_for_content_types/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ref_in_allof_response_body_for_content_types/post.py deleted file mode 100644 index cd8bf5b5070..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ref_in_allof_response_body_for_content_types/post.py +++ /dev/null @@ -1,234 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.ref_in_allof import RefInAllof - -from . import path - -SchemaFor200ResponseBodyApplicationJson = RefInAllof - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_status_code_to_response = { - '200': _response_for_200, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_ref_in_allof_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_ref_in_allof_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_ref_in_allof_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_ref_in_allof_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostRefInAllofResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_ref_in_allof_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_ref_in_allof_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_ref_in_allof_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_ref_in_allof_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_ref_in_allof_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_ref_in_allof_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ref_in_allof_response_body_for_content_types/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ref_in_allof_response_body_for_content_types/post.pyi deleted file mode 100644 index 211f9ff8d28..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ref_in_allof_response_body_for_content_types/post.pyi +++ /dev/null @@ -1,229 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.ref_in_allof import RefInAllof - -SchemaFor200ResponseBodyApplicationJson = RefInAllof - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_ref_in_allof_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_ref_in_allof_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_ref_in_allof_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_ref_in_allof_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostRefInAllofResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_ref_in_allof_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_ref_in_allof_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_ref_in_allof_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_ref_in_allof_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_ref_in_allof_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_ref_in_allof_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ref_in_allof_response_body_for_content_types/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ref_in_allof_response_body_for_content_types/post/__init__.py new file mode 100644 index 00000000000..6a796b0b4cc --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ref_in_allof_response_body_for_content_types/post/__init__.py @@ -0,0 +1,215 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 + + +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_ref_in_allof_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_ref_in_allof_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_ref_in_allof_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_ref_in_allof_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostRefInAllofResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_ref_in_allof_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_ref_in_allof_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_ref_in_allof_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_ref_in_allof_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_ref_in_allof_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_ref_in_allof_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ref_in_allof_response_body_for_content_types/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ref_in_allof_response_body_for_content_types/post/__init__.pyi new file mode 100644 index 00000000000..a065b8b6499 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ref_in_allof_response_body_for_content_types/post/__init__.pyi @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from . import response_for_200 + +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_ref_in_allof_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_ref_in_allof_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_ref_in_allof_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_ref_in_allof_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostRefInAllofResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_ref_in_allof_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_ref_in_allof_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_ref_in_allof_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_ref_in_allof_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_ref_in_allof_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_ref_in_allof_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ref_in_allof_response_body_for_content_types/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ref_in_allof_response_body_for_content_types/post/response_for_200.py new file mode 100644 index 00000000000..5dd4cfec489 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ref_in_allof_response_body_for_content_types/post/response_for_200.py @@ -0,0 +1,43 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.ref_in_allof import RefInAllof + + +class BodySchemas: + # body schemas + application_json = RefInAllof + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ref_in_anyof_response_body_for_content_types/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ref_in_anyof_response_body_for_content_types/post.py deleted file mode 100644 index c28733f77b3..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ref_in_anyof_response_body_for_content_types/post.py +++ /dev/null @@ -1,234 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.ref_in_anyof import RefInAnyof - -from . import path - -SchemaFor200ResponseBodyApplicationJson = RefInAnyof - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_status_code_to_response = { - '200': _response_for_200, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_ref_in_anyof_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_ref_in_anyof_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_ref_in_anyof_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_ref_in_anyof_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostRefInAnyofResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_ref_in_anyof_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_ref_in_anyof_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_ref_in_anyof_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_ref_in_anyof_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_ref_in_anyof_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_ref_in_anyof_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ref_in_anyof_response_body_for_content_types/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ref_in_anyof_response_body_for_content_types/post.pyi deleted file mode 100644 index 2fbc6af0e12..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ref_in_anyof_response_body_for_content_types/post.pyi +++ /dev/null @@ -1,229 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.ref_in_anyof import RefInAnyof - -SchemaFor200ResponseBodyApplicationJson = RefInAnyof - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_ref_in_anyof_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_ref_in_anyof_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_ref_in_anyof_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_ref_in_anyof_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostRefInAnyofResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_ref_in_anyof_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_ref_in_anyof_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_ref_in_anyof_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_ref_in_anyof_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_ref_in_anyof_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_ref_in_anyof_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ref_in_anyof_response_body_for_content_types/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ref_in_anyof_response_body_for_content_types/post/__init__.py new file mode 100644 index 00000000000..f4fb3e6894b --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ref_in_anyof_response_body_for_content_types/post/__init__.py @@ -0,0 +1,215 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 + + +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_ref_in_anyof_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_ref_in_anyof_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_ref_in_anyof_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_ref_in_anyof_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostRefInAnyofResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_ref_in_anyof_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_ref_in_anyof_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_ref_in_anyof_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_ref_in_anyof_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_ref_in_anyof_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_ref_in_anyof_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ref_in_anyof_response_body_for_content_types/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ref_in_anyof_response_body_for_content_types/post/__init__.pyi new file mode 100644 index 00000000000..fd0eaeb32ff --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ref_in_anyof_response_body_for_content_types/post/__init__.pyi @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from . import response_for_200 + +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_ref_in_anyof_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_ref_in_anyof_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_ref_in_anyof_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_ref_in_anyof_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostRefInAnyofResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_ref_in_anyof_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_ref_in_anyof_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_ref_in_anyof_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_ref_in_anyof_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_ref_in_anyof_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_ref_in_anyof_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ref_in_anyof_response_body_for_content_types/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ref_in_anyof_response_body_for_content_types/post/response_for_200.py new file mode 100644 index 00000000000..1fca69d9717 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ref_in_anyof_response_body_for_content_types/post/response_for_200.py @@ -0,0 +1,43 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.ref_in_anyof import RefInAnyof + + +class BodySchemas: + # body schemas + application_json = RefInAnyof + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ref_in_items_response_body_for_content_types/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ref_in_items_response_body_for_content_types/post.py deleted file mode 100644 index 77c23bc9faf..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ref_in_items_response_body_for_content_types/post.py +++ /dev/null @@ -1,234 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.ref_in_items import RefInItems - -from . import path - -SchemaFor200ResponseBodyApplicationJson = RefInItems - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_status_code_to_response = { - '200': _response_for_200, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_ref_in_items_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_ref_in_items_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_ref_in_items_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_ref_in_items_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostRefInItemsResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_ref_in_items_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_ref_in_items_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_ref_in_items_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_ref_in_items_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_ref_in_items_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_ref_in_items_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ref_in_items_response_body_for_content_types/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ref_in_items_response_body_for_content_types/post.pyi deleted file mode 100644 index eab5a6d5a4e..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ref_in_items_response_body_for_content_types/post.pyi +++ /dev/null @@ -1,229 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.ref_in_items import RefInItems - -SchemaFor200ResponseBodyApplicationJson = RefInItems - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_ref_in_items_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_ref_in_items_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_ref_in_items_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_ref_in_items_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostRefInItemsResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_ref_in_items_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_ref_in_items_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_ref_in_items_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_ref_in_items_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_ref_in_items_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_ref_in_items_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ref_in_items_response_body_for_content_types/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ref_in_items_response_body_for_content_types/post/__init__.py new file mode 100644 index 00000000000..5780c95c68b --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ref_in_items_response_body_for_content_types/post/__init__.py @@ -0,0 +1,215 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 + + +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_ref_in_items_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_ref_in_items_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_ref_in_items_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_ref_in_items_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostRefInItemsResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_ref_in_items_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_ref_in_items_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_ref_in_items_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_ref_in_items_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_ref_in_items_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_ref_in_items_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ref_in_items_response_body_for_content_types/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ref_in_items_response_body_for_content_types/post/__init__.pyi new file mode 100644 index 00000000000..1a92245e3f0 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ref_in_items_response_body_for_content_types/post/__init__.pyi @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from . import response_for_200 + +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_ref_in_items_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_ref_in_items_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_ref_in_items_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_ref_in_items_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostRefInItemsResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_ref_in_items_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_ref_in_items_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_ref_in_items_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_ref_in_items_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_ref_in_items_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_ref_in_items_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ref_in_items_response_body_for_content_types/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ref_in_items_response_body_for_content_types/post/response_for_200.py new file mode 100644 index 00000000000..a9807479bd8 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ref_in_items_response_body_for_content_types/post/response_for_200.py @@ -0,0 +1,43 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.ref_in_items import RefInItems + + +class BodySchemas: + # body schemas + application_json = RefInItems + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ref_in_not_response_body_for_content_types/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ref_in_not_response_body_for_content_types/post/__init__.py new file mode 100644 index 00000000000..01dd6396a35 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ref_in_not_response_body_for_content_types/post/__init__.py @@ -0,0 +1,215 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 + + +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_ref_in_not_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_ref_in_not_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_ref_in_not_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_ref_in_not_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostRefInNotResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_ref_in_not_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_ref_in_not_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_ref_in_not_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_ref_in_not_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_ref_in_not_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_ref_in_not_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ref_in_not_response_body_for_content_types/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ref_in_not_response_body_for_content_types/post/__init__.pyi new file mode 100644 index 00000000000..1de3a06e9d4 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ref_in_not_response_body_for_content_types/post/__init__.pyi @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from . import response_for_200 + +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_ref_in_not_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_ref_in_not_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_ref_in_not_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_ref_in_not_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostRefInNotResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_ref_in_not_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_ref_in_not_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_ref_in_not_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_ref_in_not_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_ref_in_not_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_ref_in_not_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ref_in_not_response_body_for_content_types/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ref_in_not_response_body_for_content_types/post/response_for_200.py new file mode 100644 index 00000000000..3c14196976f --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ref_in_not_response_body_for_content_types/post/response_for_200.py @@ -0,0 +1,43 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.ref_in_not import RefInNot + + +class BodySchemas: + # body schemas + application_json = RefInNot + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ref_in_oneof_response_body_for_content_types/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ref_in_oneof_response_body_for_content_types/post.py deleted file mode 100644 index 2ed178a49d9..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ref_in_oneof_response_body_for_content_types/post.py +++ /dev/null @@ -1,234 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.ref_in_oneof import RefInOneof - -from . import path - -SchemaFor200ResponseBodyApplicationJson = RefInOneof - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_status_code_to_response = { - '200': _response_for_200, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_ref_in_oneof_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_ref_in_oneof_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_ref_in_oneof_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_ref_in_oneof_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostRefInOneofResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_ref_in_oneof_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_ref_in_oneof_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_ref_in_oneof_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_ref_in_oneof_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_ref_in_oneof_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_ref_in_oneof_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ref_in_oneof_response_body_for_content_types/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ref_in_oneof_response_body_for_content_types/post.pyi deleted file mode 100644 index 53f46629860..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ref_in_oneof_response_body_for_content_types/post.pyi +++ /dev/null @@ -1,229 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.ref_in_oneof import RefInOneof - -SchemaFor200ResponseBodyApplicationJson = RefInOneof - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_ref_in_oneof_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_ref_in_oneof_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_ref_in_oneof_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_ref_in_oneof_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostRefInOneofResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_ref_in_oneof_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_ref_in_oneof_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_ref_in_oneof_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_ref_in_oneof_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_ref_in_oneof_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_ref_in_oneof_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ref_in_oneof_response_body_for_content_types/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ref_in_oneof_response_body_for_content_types/post/__init__.py new file mode 100644 index 00000000000..9334cd23ef6 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ref_in_oneof_response_body_for_content_types/post/__init__.py @@ -0,0 +1,215 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 + + +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_ref_in_oneof_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_ref_in_oneof_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_ref_in_oneof_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_ref_in_oneof_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostRefInOneofResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_ref_in_oneof_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_ref_in_oneof_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_ref_in_oneof_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_ref_in_oneof_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_ref_in_oneof_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_ref_in_oneof_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ref_in_oneof_response_body_for_content_types/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ref_in_oneof_response_body_for_content_types/post/__init__.pyi new file mode 100644 index 00000000000..70a4bdbcbc2 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ref_in_oneof_response_body_for_content_types/post/__init__.pyi @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from . import response_for_200 + +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_ref_in_oneof_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_ref_in_oneof_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_ref_in_oneof_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_ref_in_oneof_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostRefInOneofResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_ref_in_oneof_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_ref_in_oneof_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_ref_in_oneof_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_ref_in_oneof_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_ref_in_oneof_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_ref_in_oneof_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ref_in_oneof_response_body_for_content_types/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ref_in_oneof_response_body_for_content_types/post/response_for_200.py new file mode 100644 index 00000000000..5026c9179f8 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ref_in_oneof_response_body_for_content_types/post/response_for_200.py @@ -0,0 +1,43 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.ref_in_oneof import RefInOneof + + +class BodySchemas: + # body schemas + application_json = RefInOneof + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ref_in_property_response_body_for_content_types/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ref_in_property_response_body_for_content_types/post.py deleted file mode 100644 index ed51fd0f79b..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ref_in_property_response_body_for_content_types/post.py +++ /dev/null @@ -1,234 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.ref_in_property import RefInProperty - -from . import path - -SchemaFor200ResponseBodyApplicationJson = RefInProperty - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_status_code_to_response = { - '200': _response_for_200, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_ref_in_property_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_ref_in_property_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_ref_in_property_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_ref_in_property_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostRefInPropertyResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_ref_in_property_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_ref_in_property_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_ref_in_property_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_ref_in_property_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_ref_in_property_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_ref_in_property_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ref_in_property_response_body_for_content_types/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ref_in_property_response_body_for_content_types/post.pyi deleted file mode 100644 index 974eb70c891..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ref_in_property_response_body_for_content_types/post.pyi +++ /dev/null @@ -1,229 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.ref_in_property import RefInProperty - -SchemaFor200ResponseBodyApplicationJson = RefInProperty - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_ref_in_property_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_ref_in_property_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_ref_in_property_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_ref_in_property_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostRefInPropertyResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_ref_in_property_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_ref_in_property_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_ref_in_property_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_ref_in_property_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_ref_in_property_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_ref_in_property_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ref_in_property_response_body_for_content_types/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ref_in_property_response_body_for_content_types/post/__init__.py new file mode 100644 index 00000000000..f678d8d6dfc --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ref_in_property_response_body_for_content_types/post/__init__.py @@ -0,0 +1,215 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 + + +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_ref_in_property_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_ref_in_property_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_ref_in_property_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_ref_in_property_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostRefInPropertyResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_ref_in_property_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_ref_in_property_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_ref_in_property_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_ref_in_property_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_ref_in_property_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_ref_in_property_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ref_in_property_response_body_for_content_types/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ref_in_property_response_body_for_content_types/post/__init__.pyi new file mode 100644 index 00000000000..26ede3639b9 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ref_in_property_response_body_for_content_types/post/__init__.pyi @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from . import response_for_200 + +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_ref_in_property_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_ref_in_property_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_ref_in_property_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_ref_in_property_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostRefInPropertyResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_ref_in_property_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_ref_in_property_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_ref_in_property_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_ref_in_property_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_ref_in_property_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_ref_in_property_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ref_in_property_response_body_for_content_types/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ref_in_property_response_body_for_content_types/post/response_for_200.py new file mode 100644 index 00000000000..aeae8175360 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_ref_in_property_response_body_for_content_types/post/response_for_200.py @@ -0,0 +1,43 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.ref_in_property import RefInProperty + + +class BodySchemas: + # body schemas + application_json = RefInProperty + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_required_default_validation_response_body_for_content_types/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_required_default_validation_response_body_for_content_types/post.py deleted file mode 100644 index 2c1e9db6462..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_required_default_validation_response_body_for_content_types/post.py +++ /dev/null @@ -1,234 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.required_default_validation import RequiredDefaultValidation - -from . import path - -SchemaFor200ResponseBodyApplicationJson = RequiredDefaultValidation - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_status_code_to_response = { - '200': _response_for_200, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_required_default_validation_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_required_default_validation_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_required_default_validation_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_required_default_validation_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostRequiredDefaultValidationResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_required_default_validation_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_required_default_validation_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_required_default_validation_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_required_default_validation_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_required_default_validation_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_required_default_validation_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_required_default_validation_response_body_for_content_types/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_required_default_validation_response_body_for_content_types/post.pyi deleted file mode 100644 index 977571b091f..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_required_default_validation_response_body_for_content_types/post.pyi +++ /dev/null @@ -1,229 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.required_default_validation import RequiredDefaultValidation - -SchemaFor200ResponseBodyApplicationJson = RequiredDefaultValidation - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_required_default_validation_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_required_default_validation_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_required_default_validation_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_required_default_validation_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostRequiredDefaultValidationResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_required_default_validation_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_required_default_validation_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_required_default_validation_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_required_default_validation_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_required_default_validation_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_required_default_validation_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_required_default_validation_response_body_for_content_types/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_required_default_validation_response_body_for_content_types/post/__init__.py new file mode 100644 index 00000000000..1ec31a11b75 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_required_default_validation_response_body_for_content_types/post/__init__.py @@ -0,0 +1,215 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 + + +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_required_default_validation_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_required_default_validation_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_required_default_validation_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_required_default_validation_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostRequiredDefaultValidationResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_required_default_validation_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_required_default_validation_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_required_default_validation_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_required_default_validation_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_required_default_validation_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_required_default_validation_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_required_default_validation_response_body_for_content_types/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_required_default_validation_response_body_for_content_types/post/__init__.pyi new file mode 100644 index 00000000000..4f3aa8b16a0 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_required_default_validation_response_body_for_content_types/post/__init__.pyi @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from . import response_for_200 + +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_required_default_validation_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_required_default_validation_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_required_default_validation_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_required_default_validation_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostRequiredDefaultValidationResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_required_default_validation_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_required_default_validation_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_required_default_validation_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_required_default_validation_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_required_default_validation_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_required_default_validation_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_required_default_validation_response_body_for_content_types/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_required_default_validation_response_body_for_content_types/post/response_for_200.py new file mode 100644 index 00000000000..1bbd3ad8050 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_required_default_validation_response_body_for_content_types/post/response_for_200.py @@ -0,0 +1,43 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.required_default_validation import RequiredDefaultValidation + + +class BodySchemas: + # body schemas + application_json = RequiredDefaultValidation + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_required_validation_response_body_for_content_types/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_required_validation_response_body_for_content_types/post.py deleted file mode 100644 index d30d66adfde..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_required_validation_response_body_for_content_types/post.py +++ /dev/null @@ -1,234 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.required_validation import RequiredValidation - -from . import path - -SchemaFor200ResponseBodyApplicationJson = RequiredValidation - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_status_code_to_response = { - '200': _response_for_200, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_required_validation_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_required_validation_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_required_validation_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_required_validation_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostRequiredValidationResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_required_validation_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_required_validation_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_required_validation_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_required_validation_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_required_validation_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_required_validation_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_required_validation_response_body_for_content_types/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_required_validation_response_body_for_content_types/post.pyi deleted file mode 100644 index 17454c7031c..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_required_validation_response_body_for_content_types/post.pyi +++ /dev/null @@ -1,229 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.required_validation import RequiredValidation - -SchemaFor200ResponseBodyApplicationJson = RequiredValidation - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_required_validation_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_required_validation_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_required_validation_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_required_validation_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostRequiredValidationResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_required_validation_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_required_validation_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_required_validation_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_required_validation_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_required_validation_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_required_validation_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_required_validation_response_body_for_content_types/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_required_validation_response_body_for_content_types/post/__init__.py new file mode 100644 index 00000000000..7291193a613 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_required_validation_response_body_for_content_types/post/__init__.py @@ -0,0 +1,215 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 + + +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_required_validation_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_required_validation_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_required_validation_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_required_validation_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostRequiredValidationResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_required_validation_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_required_validation_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_required_validation_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_required_validation_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_required_validation_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_required_validation_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_required_validation_response_body_for_content_types/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_required_validation_response_body_for_content_types/post/__init__.pyi new file mode 100644 index 00000000000..3d25deebe25 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_required_validation_response_body_for_content_types/post/__init__.pyi @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from . import response_for_200 + +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_required_validation_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_required_validation_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_required_validation_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_required_validation_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostRequiredValidationResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_required_validation_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_required_validation_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_required_validation_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_required_validation_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_required_validation_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_required_validation_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_required_validation_response_body_for_content_types/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_required_validation_response_body_for_content_types/post/response_for_200.py new file mode 100644 index 00000000000..f88c0c855f8 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_required_validation_response_body_for_content_types/post/response_for_200.py @@ -0,0 +1,43 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.required_validation import RequiredValidation + + +class BodySchemas: + # body schemas + application_json = RequiredValidation + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_required_with_empty_array_response_body_for_content_types/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_required_with_empty_array_response_body_for_content_types/post.py deleted file mode 100644 index c951da515a9..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_required_with_empty_array_response_body_for_content_types/post.py +++ /dev/null @@ -1,234 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.required_with_empty_array import RequiredWithEmptyArray - -from . import path - -SchemaFor200ResponseBodyApplicationJson = RequiredWithEmptyArray - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_status_code_to_response = { - '200': _response_for_200, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_required_with_empty_array_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_required_with_empty_array_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_required_with_empty_array_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_required_with_empty_array_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostRequiredWithEmptyArrayResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_required_with_empty_array_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_required_with_empty_array_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_required_with_empty_array_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_required_with_empty_array_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_required_with_empty_array_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_required_with_empty_array_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_required_with_empty_array_response_body_for_content_types/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_required_with_empty_array_response_body_for_content_types/post.pyi deleted file mode 100644 index 3c36cc22f5c..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_required_with_empty_array_response_body_for_content_types/post.pyi +++ /dev/null @@ -1,229 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.required_with_empty_array import RequiredWithEmptyArray - -SchemaFor200ResponseBodyApplicationJson = RequiredWithEmptyArray - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_required_with_empty_array_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_required_with_empty_array_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_required_with_empty_array_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_required_with_empty_array_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostRequiredWithEmptyArrayResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_required_with_empty_array_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_required_with_empty_array_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_required_with_empty_array_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_required_with_empty_array_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_required_with_empty_array_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_required_with_empty_array_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_required_with_empty_array_response_body_for_content_types/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_required_with_empty_array_response_body_for_content_types/post/__init__.py new file mode 100644 index 00000000000..e45b6dc33f8 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_required_with_empty_array_response_body_for_content_types/post/__init__.py @@ -0,0 +1,215 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 + + +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_required_with_empty_array_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_required_with_empty_array_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_required_with_empty_array_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_required_with_empty_array_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostRequiredWithEmptyArrayResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_required_with_empty_array_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_required_with_empty_array_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_required_with_empty_array_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_required_with_empty_array_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_required_with_empty_array_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_required_with_empty_array_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_required_with_empty_array_response_body_for_content_types/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_required_with_empty_array_response_body_for_content_types/post/__init__.pyi new file mode 100644 index 00000000000..5f88aca1e4e --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_required_with_empty_array_response_body_for_content_types/post/__init__.pyi @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from . import response_for_200 + +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_required_with_empty_array_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_required_with_empty_array_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_required_with_empty_array_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_required_with_empty_array_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostRequiredWithEmptyArrayResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_required_with_empty_array_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_required_with_empty_array_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_required_with_empty_array_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_required_with_empty_array_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_required_with_empty_array_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_required_with_empty_array_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_required_with_empty_array_response_body_for_content_types/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_required_with_empty_array_response_body_for_content_types/post/response_for_200.py new file mode 100644 index 00000000000..baac7b93b4b --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_required_with_empty_array_response_body_for_content_types/post/response_for_200.py @@ -0,0 +1,43 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.required_with_empty_array import RequiredWithEmptyArray + + +class BodySchemas: + # body schemas + application_json = RequiredWithEmptyArray + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_required_with_escaped_characters_response_body_for_content_types/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_required_with_escaped_characters_response_body_for_content_types/post.pyi deleted file mode 100644 index 654dea6b470..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_required_with_escaped_characters_response_body_for_content_types/post.pyi +++ /dev/null @@ -1,257 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - - - -class SchemaFor200ResponseBodyApplicationJson( - schemas.AnyTypeSchema, -): - - - class MetaOapg: - required = { - "foo\"bar", - "foo\nbar", - "foo\fbar", - "foo\tbar", - "foo\rbar", - "foo\\bar", - } - - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'SchemaFor200ResponseBodyApplicationJson': - return super().__new__( - cls, - *args, - _configuration=_configuration, - **kwargs, - ) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_required_with_escaped_characters_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_required_with_escaped_characters_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_required_with_escaped_characters_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_required_with_escaped_characters_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostRequiredWithEscapedCharactersResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_required_with_escaped_characters_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_required_with_escaped_characters_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_required_with_escaped_characters_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_required_with_escaped_characters_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_required_with_escaped_characters_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_required_with_escaped_characters_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_required_with_escaped_characters_response_body_for_content_types/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_required_with_escaped_characters_response_body_for_content_types/post/__init__.py new file mode 100644 index 00000000000..9bc96a33109 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_required_with_escaped_characters_response_body_for_content_types/post/__init__.py @@ -0,0 +1,215 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 + + +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_required_with_escaped_characters_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_required_with_escaped_characters_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_required_with_escaped_characters_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_required_with_escaped_characters_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostRequiredWithEscapedCharactersResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_required_with_escaped_characters_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_required_with_escaped_characters_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_required_with_escaped_characters_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_required_with_escaped_characters_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_required_with_escaped_characters_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_required_with_escaped_characters_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_required_with_escaped_characters_response_body_for_content_types/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_required_with_escaped_characters_response_body_for_content_types/post/__init__.pyi new file mode 100644 index 00000000000..243cff48c97 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_required_with_escaped_characters_response_body_for_content_types/post/__init__.pyi @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from . import response_for_200 + +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_required_with_escaped_characters_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_required_with_escaped_characters_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_required_with_escaped_characters_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_required_with_escaped_characters_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostRequiredWithEscapedCharactersResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_required_with_escaped_characters_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_required_with_escaped_characters_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_required_with_escaped_characters_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_required_with_escaped_characters_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_required_with_escaped_characters_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_required_with_escaped_characters_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_required_with_escaped_characters_response_body_for_content_types/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_required_with_escaped_characters_response_body_for_content_types/post/response_for_200.py new file mode 100644 index 00000000000..b97f8b3a774 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_required_with_escaped_characters_response_body_for_content_types/post/response_for_200.py @@ -0,0 +1,43 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.required_with_escaped_characters import RequiredWithEscapedCharacters + + +class BodySchemas: + # body schemas + application_json = RequiredWithEscapedCharacters + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_simple_enum_validation_response_body_for_content_types/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_simple_enum_validation_response_body_for_content_types/post.py deleted file mode 100644 index 98f48905197..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_simple_enum_validation_response_body_for_content_types/post.py +++ /dev/null @@ -1,234 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.simple_enum_validation import SimpleEnumValidation - -from . import path - -SchemaFor200ResponseBodyApplicationJson = SimpleEnumValidation - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_status_code_to_response = { - '200': _response_for_200, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_simple_enum_validation_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_simple_enum_validation_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_simple_enum_validation_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_simple_enum_validation_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostSimpleEnumValidationResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_simple_enum_validation_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_simple_enum_validation_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_simple_enum_validation_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_simple_enum_validation_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_simple_enum_validation_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_simple_enum_validation_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_simple_enum_validation_response_body_for_content_types/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_simple_enum_validation_response_body_for_content_types/post.pyi deleted file mode 100644 index e8cbae9b39c..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_simple_enum_validation_response_body_for_content_types/post.pyi +++ /dev/null @@ -1,229 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.simple_enum_validation import SimpleEnumValidation - -SchemaFor200ResponseBodyApplicationJson = SimpleEnumValidation - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_simple_enum_validation_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_simple_enum_validation_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_simple_enum_validation_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_simple_enum_validation_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostSimpleEnumValidationResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_simple_enum_validation_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_simple_enum_validation_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_simple_enum_validation_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_simple_enum_validation_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_simple_enum_validation_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_simple_enum_validation_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_simple_enum_validation_response_body_for_content_types/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_simple_enum_validation_response_body_for_content_types/post/__init__.py new file mode 100644 index 00000000000..f98fc8a32aa --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_simple_enum_validation_response_body_for_content_types/post/__init__.py @@ -0,0 +1,215 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 + + +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_simple_enum_validation_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_simple_enum_validation_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_simple_enum_validation_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_simple_enum_validation_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostSimpleEnumValidationResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_simple_enum_validation_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_simple_enum_validation_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_simple_enum_validation_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_simple_enum_validation_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_simple_enum_validation_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_simple_enum_validation_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_simple_enum_validation_response_body_for_content_types/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_simple_enum_validation_response_body_for_content_types/post/__init__.pyi new file mode 100644 index 00000000000..766a8c90c59 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_simple_enum_validation_response_body_for_content_types/post/__init__.pyi @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from . import response_for_200 + +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_simple_enum_validation_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_simple_enum_validation_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_simple_enum_validation_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_simple_enum_validation_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostSimpleEnumValidationResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_simple_enum_validation_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_simple_enum_validation_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_simple_enum_validation_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_simple_enum_validation_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_simple_enum_validation_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_simple_enum_validation_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_simple_enum_validation_response_body_for_content_types/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_simple_enum_validation_response_body_for_content_types/post/response_for_200.py new file mode 100644 index 00000000000..821ee4a9745 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_simple_enum_validation_response_body_for_content_types/post/response_for_200.py @@ -0,0 +1,43 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.simple_enum_validation import SimpleEnumValidation + + +class BodySchemas: + # body schemas + application_json = SimpleEnumValidation + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_string_type_matches_strings_response_body_for_content_types/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_string_type_matches_strings_response_body_for_content_types/post.py deleted file mode 100644 index 690aca6f91d..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_string_type_matches_strings_response_body_for_content_types/post.py +++ /dev/null @@ -1,232 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from . import path - -SchemaFor200ResponseBodyApplicationJson = schemas.StrSchema - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_status_code_to_response = { - '200': _response_for_200, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_string_type_matches_strings_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_string_type_matches_strings_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_string_type_matches_strings_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_string_type_matches_strings_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostStringTypeMatchesStringsResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_string_type_matches_strings_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_string_type_matches_strings_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_string_type_matches_strings_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_string_type_matches_strings_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_string_type_matches_strings_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_string_type_matches_strings_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_string_type_matches_strings_response_body_for_content_types/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_string_type_matches_strings_response_body_for_content_types/post.pyi deleted file mode 100644 index 54bc07baa99..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_string_type_matches_strings_response_body_for_content_types/post.pyi +++ /dev/null @@ -1,227 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -SchemaFor200ResponseBodyApplicationJson = schemas.StrSchema - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_string_type_matches_strings_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_string_type_matches_strings_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_string_type_matches_strings_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_string_type_matches_strings_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostStringTypeMatchesStringsResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_string_type_matches_strings_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_string_type_matches_strings_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_string_type_matches_strings_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_string_type_matches_strings_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_string_type_matches_strings_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_string_type_matches_strings_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_string_type_matches_strings_response_body_for_content_types/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_string_type_matches_strings_response_body_for_content_types/post/__init__.py new file mode 100644 index 00000000000..4dbb61aa941 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_string_type_matches_strings_response_body_for_content_types/post/__init__.py @@ -0,0 +1,215 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 + + +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_string_type_matches_strings_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_string_type_matches_strings_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_string_type_matches_strings_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_string_type_matches_strings_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostStringTypeMatchesStringsResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_string_type_matches_strings_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_string_type_matches_strings_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_string_type_matches_strings_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_string_type_matches_strings_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_string_type_matches_strings_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_string_type_matches_strings_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_string_type_matches_strings_response_body_for_content_types/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_string_type_matches_strings_response_body_for_content_types/post/__init__.pyi new file mode 100644 index 00000000000..0641475411c --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_string_type_matches_strings_response_body_for_content_types/post/__init__.pyi @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from . import response_for_200 + +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_string_type_matches_strings_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_string_type_matches_strings_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_string_type_matches_strings_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_string_type_matches_strings_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostStringTypeMatchesStringsResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_string_type_matches_strings_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_string_type_matches_strings_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_string_type_matches_strings_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_string_type_matches_strings_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_string_type_matches_strings_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_string_type_matches_strings_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_string_type_matches_strings_response_body_for_content_types/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_string_type_matches_strings_response_body_for_content_types/post/response_for_200.py new file mode 100644 index 00000000000..f181e246e29 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_string_type_matches_strings_response_body_for_content_types/post/response_for_200.py @@ -0,0 +1,43 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.string_type_matches_strings import StringTypeMatchesStrings + + +class BodySchemas: + # body schemas + application_json = StringTypeMatchesStrings + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_response_body_for_content_types/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_response_body_for_content_types/post.py deleted file mode 100644 index f84c021f89f..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_response_body_for_content_types/post.py +++ /dev/null @@ -1,234 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.the_default_keyword_does_not_do_anything_if_the_property_is_missing import TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing - -from . import path - -SchemaFor200ResponseBodyApplicationJson = TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_status_code_to_response = { - '200': _response_for_200, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostTheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_response_body_for_content_types/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_response_body_for_content_types/post.pyi deleted file mode 100644 index 12593d9a33c..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_response_body_for_content_types/post.pyi +++ /dev/null @@ -1,229 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.the_default_keyword_does_not_do_anything_if_the_property_is_missing import TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing - -SchemaFor200ResponseBodyApplicationJson = TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostTheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_response_body_for_content_types/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_response_body_for_content_types/post/__init__.py new file mode 100644 index 00000000000..18248df72c2 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_response_body_for_content_types/post/__init__.py @@ -0,0 +1,215 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 + + +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostTheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_response_body_for_content_types/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_response_body_for_content_types/post/__init__.pyi new file mode 100644 index 00000000000..5328ab0d299 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_response_body_for_content_types/post/__init__.pyi @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from . import response_for_200 + +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostTheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_response_body_for_content_types/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_response_body_for_content_types/post/response_for_200.py new file mode 100644 index 00000000000..b293aca06b1 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_response_body_for_content_types/post/response_for_200.py @@ -0,0 +1,43 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.the_default_keyword_does_not_do_anything_if_the_property_is_missing import TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing + + +class BodySchemas: + # body schemas + application_json = TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_uniqueitems_false_validation_response_body_for_content_types/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_uniqueitems_false_validation_response_body_for_content_types/post.py deleted file mode 100644 index 6c00ce1445f..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_uniqueitems_false_validation_response_body_for_content_types/post.py +++ /dev/null @@ -1,234 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.uniqueitems_false_validation import UniqueitemsFalseValidation - -from . import path - -SchemaFor200ResponseBodyApplicationJson = UniqueitemsFalseValidation - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_status_code_to_response = { - '200': _response_for_200, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_uniqueitems_false_validation_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_uniqueitems_false_validation_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_uniqueitems_false_validation_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_uniqueitems_false_validation_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostUniqueitemsFalseValidationResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_uniqueitems_false_validation_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_uniqueitems_false_validation_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_uniqueitems_false_validation_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_uniqueitems_false_validation_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_uniqueitems_false_validation_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_uniqueitems_false_validation_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_uniqueitems_false_validation_response_body_for_content_types/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_uniqueitems_false_validation_response_body_for_content_types/post.pyi deleted file mode 100644 index c38e6e9c334..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_uniqueitems_false_validation_response_body_for_content_types/post.pyi +++ /dev/null @@ -1,229 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.uniqueitems_false_validation import UniqueitemsFalseValidation - -SchemaFor200ResponseBodyApplicationJson = UniqueitemsFalseValidation - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_uniqueitems_false_validation_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_uniqueitems_false_validation_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_uniqueitems_false_validation_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_uniqueitems_false_validation_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostUniqueitemsFalseValidationResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_uniqueitems_false_validation_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_uniqueitems_false_validation_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_uniqueitems_false_validation_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_uniqueitems_false_validation_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_uniqueitems_false_validation_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_uniqueitems_false_validation_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_uniqueitems_false_validation_response_body_for_content_types/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_uniqueitems_false_validation_response_body_for_content_types/post/__init__.py new file mode 100644 index 00000000000..497762408c7 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_uniqueitems_false_validation_response_body_for_content_types/post/__init__.py @@ -0,0 +1,215 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 + + +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_uniqueitems_false_validation_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_uniqueitems_false_validation_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_uniqueitems_false_validation_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_uniqueitems_false_validation_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostUniqueitemsFalseValidationResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_uniqueitems_false_validation_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_uniqueitems_false_validation_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_uniqueitems_false_validation_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_uniqueitems_false_validation_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_uniqueitems_false_validation_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_uniqueitems_false_validation_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_uniqueitems_false_validation_response_body_for_content_types/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_uniqueitems_false_validation_response_body_for_content_types/post/__init__.pyi new file mode 100644 index 00000000000..a189f6d307c --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_uniqueitems_false_validation_response_body_for_content_types/post/__init__.pyi @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from . import response_for_200 + +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_uniqueitems_false_validation_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_uniqueitems_false_validation_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_uniqueitems_false_validation_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_uniqueitems_false_validation_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostUniqueitemsFalseValidationResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_uniqueitems_false_validation_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_uniqueitems_false_validation_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_uniqueitems_false_validation_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_uniqueitems_false_validation_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_uniqueitems_false_validation_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_uniqueitems_false_validation_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_uniqueitems_false_validation_response_body_for_content_types/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_uniqueitems_false_validation_response_body_for_content_types/post/response_for_200.py new file mode 100644 index 00000000000..89956d6f341 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_uniqueitems_false_validation_response_body_for_content_types/post/response_for_200.py @@ -0,0 +1,43 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.uniqueitems_false_validation import UniqueitemsFalseValidation + + +class BodySchemas: + # body schemas + application_json = UniqueitemsFalseValidation + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_uniqueitems_validation_response_body_for_content_types/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_uniqueitems_validation_response_body_for_content_types/post.py deleted file mode 100644 index b8c53f797bd..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_uniqueitems_validation_response_body_for_content_types/post.py +++ /dev/null @@ -1,234 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.uniqueitems_validation import UniqueitemsValidation - -from . import path - -SchemaFor200ResponseBodyApplicationJson = UniqueitemsValidation - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_status_code_to_response = { - '200': _response_for_200, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_uniqueitems_validation_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_uniqueitems_validation_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_uniqueitems_validation_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_uniqueitems_validation_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostUniqueitemsValidationResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_uniqueitems_validation_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_uniqueitems_validation_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_uniqueitems_validation_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_uniqueitems_validation_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_uniqueitems_validation_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_uniqueitems_validation_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_uniqueitems_validation_response_body_for_content_types/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_uniqueitems_validation_response_body_for_content_types/post.pyi deleted file mode 100644 index 5d7a775bebc..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_uniqueitems_validation_response_body_for_content_types/post.pyi +++ /dev/null @@ -1,229 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from unit_test_api.model.uniqueitems_validation import UniqueitemsValidation - -SchemaFor200ResponseBodyApplicationJson = UniqueitemsValidation - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_uniqueitems_validation_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_uniqueitems_validation_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_uniqueitems_validation_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_uniqueitems_validation_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostUniqueitemsValidationResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_uniqueitems_validation_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_uniqueitems_validation_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_uniqueitems_validation_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_uniqueitems_validation_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_uniqueitems_validation_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_uniqueitems_validation_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_uniqueitems_validation_response_body_for_content_types/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_uniqueitems_validation_response_body_for_content_types/post/__init__.py new file mode 100644 index 00000000000..d91eaac6e22 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_uniqueitems_validation_response_body_for_content_types/post/__init__.py @@ -0,0 +1,215 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 + + +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_uniqueitems_validation_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_uniqueitems_validation_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_uniqueitems_validation_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_uniqueitems_validation_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostUniqueitemsValidationResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_uniqueitems_validation_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_uniqueitems_validation_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_uniqueitems_validation_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_uniqueitems_validation_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_uniqueitems_validation_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_uniqueitems_validation_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_uniqueitems_validation_response_body_for_content_types/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_uniqueitems_validation_response_body_for_content_types/post/__init__.pyi new file mode 100644 index 00000000000..53182b34abb --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_uniqueitems_validation_response_body_for_content_types/post/__init__.pyi @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from . import response_for_200 + +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_uniqueitems_validation_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_uniqueitems_validation_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_uniqueitems_validation_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_uniqueitems_validation_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostUniqueitemsValidationResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_uniqueitems_validation_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_uniqueitems_validation_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_uniqueitems_validation_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_uniqueitems_validation_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_uniqueitems_validation_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_uniqueitems_validation_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_uniqueitems_validation_response_body_for_content_types/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_uniqueitems_validation_response_body_for_content_types/post/response_for_200.py new file mode 100644 index 00000000000..85ea5c4ec74 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_uniqueitems_validation_response_body_for_content_types/post/response_for_200.py @@ -0,0 +1,43 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.uniqueitems_validation import UniqueitemsValidation + + +class BodySchemas: + # body schemas + application_json = UniqueitemsValidation + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_uri_format_response_body_for_content_types/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_uri_format_response_body_for_content_types/post.py deleted file mode 100644 index 5049eb56e95..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_uri_format_response_body_for_content_types/post.py +++ /dev/null @@ -1,254 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from . import path - - - -class SchemaFor200ResponseBodyApplicationJson( - schemas.AnyTypeSchema, -): - - - class MetaOapg: - format = 'uri' - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'SchemaFor200ResponseBodyApplicationJson': - return super().__new__( - cls, - *args, - _configuration=_configuration, - **kwargs, - ) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_status_code_to_response = { - '200': _response_for_200, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_uri_format_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_uri_format_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_uri_format_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_uri_format_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostUriFormatResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_uri_format_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_uri_format_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_uri_format_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_uri_format_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_uri_format_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_uri_format_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_uri_format_response_body_for_content_types/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_uri_format_response_body_for_content_types/post.pyi deleted file mode 100644 index 119a9678d7b..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_uri_format_response_body_for_content_types/post.pyi +++ /dev/null @@ -1,249 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - - - -class SchemaFor200ResponseBodyApplicationJson( - schemas.AnyTypeSchema, -): - - - class MetaOapg: - format = 'uri' - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'SchemaFor200ResponseBodyApplicationJson': - return super().__new__( - cls, - *args, - _configuration=_configuration, - **kwargs, - ) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_uri_format_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_uri_format_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_uri_format_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_uri_format_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostUriFormatResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_uri_format_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_uri_format_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_uri_format_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_uri_format_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_uri_format_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_uri_format_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_uri_format_response_body_for_content_types/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_uri_format_response_body_for_content_types/post/__init__.py new file mode 100644 index 00000000000..5a40cb5e626 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_uri_format_response_body_for_content_types/post/__init__.py @@ -0,0 +1,215 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 + + +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_uri_format_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_uri_format_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_uri_format_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_uri_format_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostUriFormatResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_uri_format_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_uri_format_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_uri_format_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_uri_format_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_uri_format_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_uri_format_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_uri_format_response_body_for_content_types/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_uri_format_response_body_for_content_types/post/__init__.pyi new file mode 100644 index 00000000000..9edab25419c --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_uri_format_response_body_for_content_types/post/__init__.pyi @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from . import response_for_200 + +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_uri_format_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_uri_format_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_uri_format_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_uri_format_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostUriFormatResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_uri_format_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_uri_format_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_uri_format_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_uri_format_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_uri_format_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_uri_format_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_uri_format_response_body_for_content_types/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_uri_format_response_body_for_content_types/post/response_for_200.py new file mode 100644 index 00000000000..ce8690e487c --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_uri_format_response_body_for_content_types/post/response_for_200.py @@ -0,0 +1,43 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.uri_format import UriFormat + + +class BodySchemas: + # body schemas + application_json = UriFormat + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_uri_reference_format_response_body_for_content_types/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_uri_reference_format_response_body_for_content_types/post.py deleted file mode 100644 index 65ecca6b552..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_uri_reference_format_response_body_for_content_types/post.py +++ /dev/null @@ -1,254 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from . import path - - - -class SchemaFor200ResponseBodyApplicationJson( - schemas.AnyTypeSchema, -): - - - class MetaOapg: - format = 'uri-reference' - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'SchemaFor200ResponseBodyApplicationJson': - return super().__new__( - cls, - *args, - _configuration=_configuration, - **kwargs, - ) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_status_code_to_response = { - '200': _response_for_200, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_uri_reference_format_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_uri_reference_format_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_uri_reference_format_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_uri_reference_format_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostUriReferenceFormatResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_uri_reference_format_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_uri_reference_format_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_uri_reference_format_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_uri_reference_format_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_uri_reference_format_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_uri_reference_format_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_uri_reference_format_response_body_for_content_types/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_uri_reference_format_response_body_for_content_types/post.pyi deleted file mode 100644 index 985665f5486..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_uri_reference_format_response_body_for_content_types/post.pyi +++ /dev/null @@ -1,249 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - - - -class SchemaFor200ResponseBodyApplicationJson( - schemas.AnyTypeSchema, -): - - - class MetaOapg: - format = 'uri-reference' - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'SchemaFor200ResponseBodyApplicationJson': - return super().__new__( - cls, - *args, - _configuration=_configuration, - **kwargs, - ) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_uri_reference_format_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_uri_reference_format_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_uri_reference_format_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_uri_reference_format_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostUriReferenceFormatResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_uri_reference_format_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_uri_reference_format_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_uri_reference_format_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_uri_reference_format_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_uri_reference_format_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_uri_reference_format_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_uri_reference_format_response_body_for_content_types/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_uri_reference_format_response_body_for_content_types/post/__init__.py new file mode 100644 index 00000000000..29b04783d3f --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_uri_reference_format_response_body_for_content_types/post/__init__.py @@ -0,0 +1,215 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 + + +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_uri_reference_format_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_uri_reference_format_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_uri_reference_format_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_uri_reference_format_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostUriReferenceFormatResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_uri_reference_format_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_uri_reference_format_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_uri_reference_format_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_uri_reference_format_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_uri_reference_format_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_uri_reference_format_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_uri_reference_format_response_body_for_content_types/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_uri_reference_format_response_body_for_content_types/post/__init__.pyi new file mode 100644 index 00000000000..41e7160464e --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_uri_reference_format_response_body_for_content_types/post/__init__.pyi @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from . import response_for_200 + +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_uri_reference_format_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_uri_reference_format_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_uri_reference_format_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_uri_reference_format_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostUriReferenceFormatResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_uri_reference_format_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_uri_reference_format_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_uri_reference_format_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_uri_reference_format_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_uri_reference_format_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_uri_reference_format_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_uri_reference_format_response_body_for_content_types/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_uri_reference_format_response_body_for_content_types/post/response_for_200.py new file mode 100644 index 00000000000..6eb9c2351b9 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_uri_reference_format_response_body_for_content_types/post/response_for_200.py @@ -0,0 +1,43 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.uri_reference_format import UriReferenceFormat + + +class BodySchemas: + # body schemas + application_json = UriReferenceFormat + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_uri_template_format_response_body_for_content_types/post.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_uri_template_format_response_body_for_content_types/post.py deleted file mode 100644 index 52dcf6763da..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_uri_template_format_response_body_for_content_types/post.py +++ /dev/null @@ -1,254 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - -from . import path - - - -class SchemaFor200ResponseBodyApplicationJson( - schemas.AnyTypeSchema, -): - - - class MetaOapg: - format = 'uri-template' - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'SchemaFor200ResponseBodyApplicationJson': - return super().__new__( - cls, - *args, - _configuration=_configuration, - **kwargs, - ) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_status_code_to_response = { - '200': _response_for_200, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_uri_template_format_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_uri_template_format_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_uri_template_format_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_uri_template_format_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostUriTemplateFormatResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_uri_template_format_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_uri_template_format_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_uri_template_format_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_uri_template_format_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_uri_template_format_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_uri_template_format_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_uri_template_format_response_body_for_content_types/post.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_uri_template_format_response_body_for_content_types/post.pyi deleted file mode 100644 index 7d1760c1b73..00000000000 --- a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_uri_template_format_response_body_for_content_types/post.pyi +++ /dev/null @@ -1,249 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from unit_test_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from unit_test_api import schemas # noqa: F401 - - - -class SchemaFor200ResponseBodyApplicationJson( - schemas.AnyTypeSchema, -): - - - class MetaOapg: - format = 'uri-template' - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'SchemaFor200ResponseBodyApplicationJson': - return super().__new__( - cls, - *args, - _configuration=_configuration, - **kwargs, - ) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_uri_template_format_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_uri_template_format_response_body_for_content_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_uri_template_format_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_uri_template_format_response_body_for_content_types_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostUriTemplateFormatResponseBodyForContentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_uri_template_format_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_uri_template_format_response_body_for_content_types( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_uri_template_format_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_uri_template_format_response_body_for_content_types( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_uri_template_format_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_uri_template_format_response_body_for_content_types_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_uri_template_format_response_body_for_content_types/post/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_uri_template_format_response_body_for_content_types/post/__init__.py new file mode 100644 index 00000000000..f65e033589f --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_uri_template_format_response_body_for_content_types/post/__init__.py @@ -0,0 +1,215 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 + + +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_uri_template_format_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_uri_template_format_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_uri_template_format_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_uri_template_format_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostUriTemplateFormatResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_uri_template_format_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_uri_template_format_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_uri_template_format_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_uri_template_format_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_uri_template_format_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_uri_template_format_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_uri_template_format_response_body_for_content_types/post/__init__.pyi b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_uri_template_format_response_body_for_content_types/post/__init__.pyi new file mode 100644 index 00000000000..4f24c328f6e --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_uri_template_format_response_body_for_content_types/post/__init__.pyi @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from unit_test_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from . import response_for_200 + +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_uri_template_format_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_uri_template_format_response_body_for_content_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_uri_template_format_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_uri_template_format_response_body_for_content_types_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostUriTemplateFormatResponseBodyForContentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_uri_template_format_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_uri_template_format_response_body_for_content_types( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_uri_template_format_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_uri_template_format_response_body_for_content_types( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_uri_template_format_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_uri_template_format_response_body_for_content_types_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_uri_template_format_response_body_for_content_types/post/response_for_200.py b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_uri_template_format_response_body_for_content_types/post/response_for_200.py new file mode 100644 index 00000000000..7dffeb92126 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/response_body_post_uri_template_format_response_body_for_content_types/post/response_for_200.py @@ -0,0 +1,43 @@ +import dataclasses +import urllib3 + +from unit_test_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from unit_test_api import schemas # noqa: F401 + +from unit_test_api.model.uri_template_format import UriTemplateFormat + + +class BodySchemas: + # body schemas + application_json = UriTemplateFormat + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/features/nonCompliantUseDiscriminatorIfCompositionFails/python/docs/apis/tags/DefaultApi.md b/samples/openapi3/client/features/nonCompliantUseDiscriminatorIfCompositionFails/python/docs/apis/tags/DefaultApi.md index b361ea6af0e..7f698cf05b0 100644 --- a/samples/openapi3/client/features/nonCompliantUseDiscriminatorIfCompositionFails/python/docs/apis/tags/DefaultApi.md +++ b/samples/openapi3/client/features/nonCompliantUseDiscriminatorIfCompositionFails/python/docs/apis/tags/DefaultApi.md @@ -9,8 +9,6 @@ Method | HTTP request | Description # **post_operators** -> post_operators() - ### Example @@ -48,15 +46,15 @@ with this_package.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson, Unset] | optional, default is unset | +[body](#post_operators.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#post_operators.RequestBody.Schemas.application_json), Unset] | optional, default is unset | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**Operator**](../../models/Operator.md) | | @@ -67,9 +65,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#post_operators.ApiResponseFor200) | OK +200 | [response_for_200.ApiResponse](#post_operators.response_for_200.ApiResponse) | OK -#### post_operators.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | diff --git a/samples/openapi3/client/features/nonCompliantUseDiscriminatorIfCompositionFails/python/this_package/api_client.py b/samples/openapi3/client/features/nonCompliantUseDiscriminatorIfCompositionFails/python/this_package/api_client.py index 048ae4ed1ba..f2dec0cb228 100644 --- a/samples/openapi3/client/features/nonCompliantUseDiscriminatorIfCompositionFails/python/this_package/api_client.py +++ b/samples/openapi3/client/features/nonCompliantUseDiscriminatorIfCompositionFails/python/this_package/api_client.py @@ -8,7 +8,7 @@ Generated by: https://openapi-generator.tech """ -from dataclasses import dataclass +import dataclasses from decimal import Decimal import enum import email @@ -343,7 +343,7 @@ def _content_type_is_json(cls, content_type: str) -> bool: return False -@dataclass +@dataclasses.dataclass class ParameterBase(JSONDetector): name: str in_type: ParameterInType @@ -783,7 +783,7 @@ def __init__( self.allow_reserved = allow_reserved -@dataclass +@dataclasses.dataclass class MediaType: """ Used to store request and response body schema information @@ -797,7 +797,7 @@ class MediaType: encoding: typing.Optional[typing.Dict[str, Encoding]] = None -@dataclass +@dataclasses.dataclass class ApiResponse: response: urllib3.HTTPResponse body: typing.Union[Unset, Schema] @@ -806,8 +806,8 @@ class ApiResponse: def __init__( self, response: urllib3.HTTPResponse, - body: typing.Union[Unset, typing.Type[Schema]], - headers: typing.Union[Unset, typing.List[HeaderParameter]] + body: typing.Union[Unset, typing.Type[Schema]] = unset, + headers: typing.Union[Unset, typing.List[HeaderParameter]] = unset ): """ pycharm needs this to prevent 'Unexpected argument' warnings @@ -817,7 +817,7 @@ def __init__( self.headers = headers -@dataclass +@dataclasses.dataclass class ApiResponseWithoutDeserialization(ApiResponse): response: urllib3.HTTPResponse body: typing.Union[Unset, typing.Type[Schema]] = unset diff --git a/samples/openapi3/client/features/nonCompliantUseDiscriminatorIfCompositionFails/python/this_package/paths/operators/post.py b/samples/openapi3/client/features/nonCompliantUseDiscriminatorIfCompositionFails/python/this_package/paths/operators/post.py deleted file mode 100644 index e6ec8da5ab5..00000000000 --- a/samples/openapi3/client/features/nonCompliantUseDiscriminatorIfCompositionFails/python/this_package/paths/operators/post.py +++ /dev/null @@ -1,295 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from this_package import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from this_package import schemas # noqa: F401 - -from this_package.model.operator import Operator - -from . import path - -# body param -SchemaForRequestBodyApplicationJson = Operator - - -request_body_operator = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) -_status_code_to_response = { - '200': _response_for_200, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _post_operators_oapg( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_operators_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_operators_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_operators_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_operators_oapg( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - _fields = None - _body = None - if body is not schemas.unset: - serialized_data = request_body_operator.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostOperators(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_operators( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_operators( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_operators( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_operators( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_operators( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_operators_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_operators_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/features/nonCompliantUseDiscriminatorIfCompositionFails/python/this_package/paths/operators/post.pyi b/samples/openapi3/client/features/nonCompliantUseDiscriminatorIfCompositionFails/python/this_package/paths/operators/post.pyi deleted file mode 100644 index 3c4515d0d82..00000000000 --- a/samples/openapi3/client/features/nonCompliantUseDiscriminatorIfCompositionFails/python/this_package/paths/operators/post.pyi +++ /dev/null @@ -1,290 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from this_package import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from this_package import schemas # noqa: F401 - -from this_package.model.operator import Operator - -# body param -SchemaForRequestBodyApplicationJson = Operator - - -request_body_operator = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _post_operators_oapg( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _post_operators_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _post_operators_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _post_operators_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _post_operators_oapg( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - _fields = None - _body = None - if body is not schemas.unset: - serialized_data = request_body_operator.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PostOperators(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def post_operators( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post_operators( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post_operators( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post_operators( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post_operators( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_operators_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._post_operators_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/features/nonCompliantUseDiscriminatorIfCompositionFails/python/this_package/paths/operators/post/__init__.py b/samples/openapi3/client/features/nonCompliantUseDiscriminatorIfCompositionFails/python/this_package/paths/operators/post/__init__.py new file mode 100644 index 00000000000..e02bf809a11 --- /dev/null +++ b/samples/openapi3/client/features/nonCompliantUseDiscriminatorIfCompositionFails/python/this_package/paths/operators/post/__init__.py @@ -0,0 +1,288 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from this_package import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from this_package import schemas # noqa: F401 + +from this_package.model.operator import Operator + +from .. import path +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = Operator + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + ) + +_status_code_to_response = { + '200': response_for_200.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _post_operators_oapg( + self, + content_type: typing_extensions.Literal["application/json"] = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_operators_oapg( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_operators_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_operators_oapg( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_operators_oapg( + self, + content_type: str = 'application/json', + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + _fields = None + _body = None + if body is not schemas.unset: + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostOperators(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_operators( + self, + content_type: typing_extensions.Literal["application/json"] = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_operators( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_operators( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_operators( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_operators( + self, + content_type: str = 'application/json', + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_operators_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + content_type: typing_extensions.Literal["application/json"] = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + content_type: str = 'application/json', + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_operators_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/features/nonCompliantUseDiscriminatorIfCompositionFails/python/this_package/paths/operators/post/__init__.pyi b/samples/openapi3/client/features/nonCompliantUseDiscriminatorIfCompositionFails/python/this_package/paths/operators/post/__init__.pyi new file mode 100644 index 00000000000..94e55528f7e --- /dev/null +++ b/samples/openapi3/client/features/nonCompliantUseDiscriminatorIfCompositionFails/python/this_package/paths/operators/post/__init__.pyi @@ -0,0 +1,283 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from this_package import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from this_package import schemas # noqa: F401 + +from this_package.model.operator import Operator + +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = Operator + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + ) + + +class BaseApi(api_client.Api): + @typing.overload + def _post_operators_oapg( + self, + content_type: typing_extensions.Literal["application/json"] = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _post_operators_oapg( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _post_operators_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _post_operators_oapg( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _post_operators_oapg( + self, + content_type: str = 'application/json', + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + _fields = None + _body = None + if body is not schemas.unset: + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PostOperators(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def post_operators( + self, + content_type: typing_extensions.Literal["application/json"] = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post_operators( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post_operators( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post_operators( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post_operators( + self, + content_type: str = 'application/json', + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_operators_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + content_type: typing_extensions.Literal["application/json"] = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + content_type: str = 'application/json', + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._post_operators_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/features/nonCompliantUseDiscriminatorIfCompositionFails/python/this_package/paths/operators/post/response_for_200.py b/samples/openapi3/client/features/nonCompliantUseDiscriminatorIfCompositionFails/python/this_package/paths/operators/post/response_for_200.py new file mode 100644 index 00000000000..e0baa88e632 --- /dev/null +++ b/samples/openapi3/client/features/nonCompliantUseDiscriminatorIfCompositionFails/python/this_package/paths/operators/post/response_for_200.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from this_package import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from this_package import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/petstore/python/docs/apis/tags/AnotherFakeApi.md b/samples/openapi3/client/petstore/python/docs/apis/tags/AnotherFakeApi.md index 2a76dabc358..9e3e1779229 100644 --- a/samples/openapi3/client/petstore/python/docs/apis/tags/AnotherFakeApi.md +++ b/samples/openapi3/client/petstore/python/docs/apis/tags/AnotherFakeApi.md @@ -9,7 +9,6 @@ Method | HTTP request | Description # **call_123_test_special_tags** -> Client call_123_test_special_tags(client) To test special tags @@ -50,16 +49,16 @@ with petstore_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#call_123_test_special_tags.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#call_123_test_special_tags.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body accept_content_types | typing.Tuple[str] | default is ('application/json', ) | Tells the server the content type(s) that are accepted by the client stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**Client**](../../models/Client.md) | | @@ -70,16 +69,16 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#call_123_test_special_tags.ApiResponseFor200) | successful operation +200 | [response_for_200.ApiResponse](#call_123_test_special_tags.response_for_200.ApiResponse) | successful operation -#### call_123_test_special_tags.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#call_123_test_special_tags.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**Client**](../../models/Client.md) | | diff --git a/samples/openapi3/client/petstore/python/docs/apis/tags/DefaultApi.md b/samples/openapi3/client/petstore/python/docs/apis/tags/DefaultApi.md index 768d80a1c35..b5429ec3839 100644 --- a/samples/openapi3/client/petstore/python/docs/apis/tags/DefaultApi.md +++ b/samples/openapi3/client/petstore/python/docs/apis/tags/DefaultApi.md @@ -9,8 +9,6 @@ Method | HTTP request | Description # **foo_get** -> {str: (bool, date, datetime, dict, float, int, list, str, none_type)} foo_get() - ### Example @@ -18,7 +16,6 @@ Method | HTTP request | Description ```python import petstore_api from petstore_api.apis.tags import default_api -from petstore_api.model.foo import Foo 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. @@ -46,16 +43,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -default | [ApiResponseForDefault](#foo_get.ApiResponseForDefault) | response +default | [response_for_default.ApiResponse](#foo_get.response_for_default.ApiResponse) | response -#### foo_get.ApiResponseForDefault +#### response_for_default.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor0ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_0.BodySchemas.application_json](#foo_get.response_for_0.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor0ResponseBodyApplicationJson +# response_for_0.BodySchemas.application_json ## Model Type Info Input Type | Accessed Type | Description | Notes diff --git a/samples/openapi3/client/petstore/python/docs/apis/tags/FakeApi.md b/samples/openapi3/client/petstore/python/docs/apis/tags/FakeApi.md index e8690102866..f65600a5042 100644 --- a/samples/openapi3/client/petstore/python/docs/apis/tags/FakeApi.md +++ b/samples/openapi3/client/petstore/python/docs/apis/tags/FakeApi.md @@ -41,7 +41,6 @@ Method | HTTP request | Description # **additional_properties_with_array_of_enums** -> AdditionalPropertiesWithArrayOfEnums additional_properties_with_array_of_enums() Additional Properties with Array of Enums @@ -82,16 +81,16 @@ with petstore_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson, Unset] | optional, default is unset | +[body](#additional_properties_with_array_of_enums.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#additional_properties_with_array_of_enums.RequestBody.Schemas.application_json), Unset] | optional, default is unset | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body accept_content_types | typing.Tuple[str] | default is ('application/json', ) | Tells the server the content type(s) that are accepted by the client stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AdditionalPropertiesWithArrayOfEnums**](../../models/AdditionalPropertiesWithArrayOfEnums.md) | | @@ -102,16 +101,16 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#additional_properties_with_array_of_enums.ApiResponseFor200) | Got object with additional properties with array of enums +200 | [response_for_200.ApiResponse](#additional_properties_with_array_of_enums.response_for_200.ApiResponse) | Got object with additional properties with array of enums -#### additional_properties_with_array_of_enums.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#additional_properties_with_array_of_enums.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AdditionalPropertiesWithArrayOfEnums**](../../models/AdditionalPropertiesWithArrayOfEnums.md) | | @@ -125,8 +124,6 @@ No authorization required # **array_model** -> AnimalFarm array_model() - Test serialization of ArrayModel @@ -165,16 +162,16 @@ with petstore_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson, Unset] | optional, default is unset | +[body](#array_model.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#array_model.RequestBody.Schemas.application_json), Unset] | optional, default is unset | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body accept_content_types | typing.Tuple[str] | default is ('application/json', ) | Tells the server the content type(s) that are accepted by the client stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AnimalFarm**](../../models/AnimalFarm.md) | | @@ -185,16 +182,16 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#array_model.ApiResponseFor200) | Output model +200 | [response_for_200.ApiResponse](#array_model.response_for_200.ApiResponse) | Output model -#### array_model.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#array_model.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**AnimalFarm**](../../models/AnimalFarm.md) | | @@ -208,7 +205,6 @@ No authorization required # **array_of_enums** -> ArrayOfEnums array_of_enums() Array of Enums @@ -247,16 +243,16 @@ with petstore_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson, Unset] | optional, default is unset | +[body](#array_of_enums.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#array_of_enums.RequestBody.Schemas.application_json), Unset] | optional, default is unset | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body accept_content_types | typing.Tuple[str] | default is ('application/json', ) | Tells the server the content type(s) that are accepted by the client stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**ArrayOfEnums**](../../models/ArrayOfEnums.md) | | @@ -267,16 +263,16 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#array_of_enums.ApiResponseFor200) | Got named array of enums +200 | [response_for_200.ApiResponse](#array_of_enums.response_for_200.ApiResponse) | Got named array of enums -#### array_of_enums.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#array_of_enums.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**ArrayOfEnums**](../../models/ArrayOfEnums.md) | | @@ -290,8 +286,6 @@ No authorization required # **body_with_file_schema** -> body_with_file_schema(file_schema_test_class) - For this test, the body for this request much reference a schema named `File`. @@ -334,15 +328,15 @@ with petstore_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#body_with_file_schema.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#body_with_file_schema.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**FileSchemaTestClass**](../../models/FileSchemaTestClass.md) | | @@ -353,9 +347,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#body_with_file_schema.ApiResponseFor200) | Success +200 | [response_for_200.ApiResponse](#body_with_file_schema.response_for_200.ApiResponse) | Success -#### body_with_file_schema.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -370,8 +364,6 @@ No authorization required # **body_with_query_params** -> body_with_query_params(queryuser) - ### Example @@ -423,30 +415,30 @@ with petstore_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | -query_params | RequestQueryParams | | +[body](#body_with_query_params.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#body_with_query_params.RequestBody.Schemas.application_json)] | required | +[query_params](#body_with_query_params.RequestQueryParameters) | [RequestQueryParameters.Params](#body_with_query_params.RequestQueryParameters.Params) | | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**User**](../../models/User.md) | | -### query_params -#### RequestQueryParams +### query_params +#### RequestQueryParameters.Params -Name | Type | Description | Notes +Key | Input Type | Description | Notes ------------- | ------------- | ------------- | ------------- -query | QuerySchema | | +query | [RequestQueryParameters.Schemas.query](#body_with_query_params.RequestQueryParameters.Schemas.query) | | -# QuerySchema +# RequestQueryParameters.Schemas.query ## Model Type Info Input Type | Accessed Type | Description | Notes @@ -458,9 +450,9 @@ str, | str, | | Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#body_with_query_params.ApiResponseFor200) | Success +200 | [response_for_200.ApiResponse](#body_with_query_params.response_for_200.ApiResponse) | Success -#### body_with_query_params.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -475,8 +467,6 @@ No authorization required # **boolean** -> bool boolean() - Test serialization of outer boolean types @@ -486,6 +476,7 @@ Test serialization of outer boolean types ```python import petstore_api from petstore_api.apis.tags import fake_api +from petstore_api.model.boolean import Boolean 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. @@ -499,7 +490,7 @@ with petstore_api.ApiClient(configuration) as api_client: api_instance = fake_api.FakeApi(api_client) # example passing only optional values - body = True + body = Boolean(True) try: api_response = api_instance.boolean( body=body, @@ -512,42 +503,40 @@ with petstore_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson, Unset] | optional, default is unset | +[body](#boolean.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#boolean.RequestBody.Schemas.application_json), Unset] | optional, default is unset | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body accept_content_types | typing.Tuple[str] | default is ('application/json', ) | Tells the server the content type(s) that are accepted by the client stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**Boolean**](../../models/Boolean.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -bool, | BoolClass, | | ### Return Types, Responses Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#boolean.ApiResponseFor200) | Output boolean +200 | [response_for_200.ApiResponse](#boolean.response_for_200.ApiResponse) | Output boolean -#### boolean.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#boolean.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**Boolean**](../../models/Boolean.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -bool, | BoolClass, | | ### Authorization @@ -557,8 +546,6 @@ No authorization required # **case_sensitive_params** -> case_sensitive_params(some_varsome_var2some_var3) - Ensures that original naming is used in endpoint params, that way we on't have collisions @@ -597,36 +584,36 @@ with petstore_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -query_params | RequestQueryParams | | +[query_params](#case_sensitive_params.RequestQueryParameters) | [RequestQueryParameters.Params](#case_sensitive_params.RequestQueryParameters.Params) | | stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### query_params -#### RequestQueryParams +### query_params +#### RequestQueryParameters.Params -Name | Type | Description | Notes +Key | Input Type | Description | Notes ------------- | ------------- | ------------- | ------------- -someVar | SomeVarSchema | | -SomeVar | SomeVarSchema | | -some_var | SomeVarSchema | | +someVar | [RequestQueryParameters.Schemas.someVar](#case_sensitive_params.RequestQueryParameters.Schemas.someVar) | | +SomeVar | [RequestQueryParameters.Schemas.SomeVar](#case_sensitive_params.RequestQueryParameters.Schemas.SomeVar) | | +some_var | [RequestQueryParameters.Schemas.some_var](#case_sensitive_params.RequestQueryParameters.Schemas.some_var) | | -# SomeVarSchema +# RequestQueryParameters.Schemas.someVar ## Model Type Info Input Type | Accessed Type | Description | Notes ------------ | ------------- | ------------- | ------------- str, | str, | | -# SomeVarSchema +# RequestQueryParameters.Schemas.SomeVar ## Model Type Info Input Type | Accessed Type | Description | Notes ------------ | ------------- | ------------- | ------------- str, | str, | | -# SomeVarSchema +# RequestQueryParameters.Schemas.some_var ## Model Type Info Input Type | Accessed Type | Description | Notes @@ -638,9 +625,9 @@ str, | str, | | Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#case_sensitive_params.ApiResponseFor200) | Success +200 | [response_for_200.ApiResponse](#case_sensitive_params.response_for_200.ApiResponse) | Success -#### case_sensitive_params.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -655,7 +642,6 @@ No authorization required # **client_model** -> Client client_model(client) To test \"client\" model @@ -696,16 +682,16 @@ with petstore_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#client_model.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#client_model.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body accept_content_types | typing.Tuple[str] | default is ('application/json', ) | Tells the server the content type(s) that are accepted by the client stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**Client**](../../models/Client.md) | | @@ -716,16 +702,16 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#client_model.ApiResponseFor200) | successful operation +200 | [response_for_200.ApiResponse](#client_model.response_for_200.ApiResponse) | successful operation -#### client_model.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#client_model.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**Client**](../../models/Client.md) | | @@ -739,8 +725,6 @@ No authorization required # **composed_one_of_different_types** -> ComposedOneOfDifferentTypes composed_one_of_different_types() - Test serialization of object with $refed properties @@ -777,16 +761,16 @@ with petstore_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson, Unset] | optional, default is unset | +[body](#composed_one_of_different_types.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#composed_one_of_different_types.RequestBody.Schemas.application_json), Unset] | optional, default is unset | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body accept_content_types | typing.Tuple[str] | default is ('application/json', ) | Tells the server the content type(s) that are accepted by the client stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**ComposedOneOfDifferentTypes**](../../models/ComposedOneOfDifferentTypes.md) | | @@ -797,16 +781,16 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#composed_one_of_different_types.ApiResponseFor200) | Output model +200 | [response_for_200.ApiResponse](#composed_one_of_different_types.response_for_200.ApiResponse) | Output model -#### composed_one_of_different_types.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#composed_one_of_different_types.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**ComposedOneOfDifferentTypes**](../../models/ComposedOneOfDifferentTypes.md) | | @@ -820,7 +804,6 @@ No authorization required # **delete_coffee** -> delete_coffee(id) Delete coffee @@ -859,19 +842,19 @@ with petstore_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -path_params | RequestPathParams | | +[path_params](#delete_coffee.RequestPathParameters) | [RequestPathParameters.Params](#delete_coffee.RequestPathParameters.Params) | | stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### path_params -#### RequestPathParams +### path_params +#### RequestPathParameters.Params -Name | Type | Description | Notes +Key | Input Type | Description | Notes ------------- | ------------- | ------------- | ------------- -id | IdSchema | | +id | [RequestPathParameters.Schemas.id](#delete_coffee.RequestPathParameters.Schemas.id) | | -# IdSchema +# RequestPathParameters.Schemas.id ## Model Type Info Input Type | Accessed Type | Description | Notes @@ -883,17 +866,17 @@ str, | str, | | Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#delete_coffee.ApiResponseFor200) | OK -default | [ApiResponseForDefault](#delete_coffee.ApiResponseForDefault) | Unexpected error +200 | [response_for_200.ApiResponse](#delete_coffee.response_for_200.ApiResponse) | OK +default | [response_for_default.ApiResponse](#delete_coffee.response_for_default.ApiResponse) | Unexpected error -#### delete_coffee.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | body | Unset | body was not defined | headers | Unset | headers were not defined | -#### delete_coffee.ApiResponseForDefault +#### response_for_default.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -908,7 +891,6 @@ No authorization required # **endpoint_parameters** -> endpoint_parameters() Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 @@ -971,15 +953,15 @@ with petstore_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, Unset] | optional, default is unset | +[body](#endpoint_parameters.RequestBody) | typing.Union[[RequestBody.Schemas.application_x_www_form_urlencoded](#endpoint_parameters.RequestBody.Schemas.application_x_www_form_urlencoded), Unset] | optional, default is unset | content_type | str | optional, default is 'application/x-www-form-urlencoded' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationXWwwFormUrlencoded +# RequestBody.Schemas.application_x_www_form_urlencoded ## Model Type Info Input Type | Accessed Type | Description | Notes @@ -1010,17 +992,17 @@ Key | Input Type | Accessed Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#endpoint_parameters.ApiResponseFor200) | Success -404 | [ApiResponseFor404](#endpoint_parameters.ApiResponseFor404) | User not found +200 | [response_for_200.ApiResponse](#endpoint_parameters.response_for_200.ApiResponse) | Success +404 | [response_for_404.ApiResponse](#endpoint_parameters.response_for_404.ApiResponse) | User not found -#### endpoint_parameters.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | body | Unset | body was not defined | headers | Unset | headers were not defined | -#### endpoint_parameters.ApiResponseFor404 +#### response_for_404.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -1035,7 +1017,6 @@ headers | Unset | headers were not defined | # **enum_parameters** -> enum_parameters() To test enum parameters @@ -1093,17 +1074,17 @@ with petstore_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, Unset] | optional, default is unset | -query_params | RequestQueryParams | | -header_params | RequestHeaderParams | | +[body](#enum_parameters.RequestBody) | typing.Union[[RequestBody.Schemas.application_x_www_form_urlencoded](#enum_parameters.RequestBody.Schemas.application_x_www_form_urlencoded), Unset] | optional, default is unset | +[query_params](#enum_parameters.RequestQueryParameters) | [RequestQueryParameters.Params](#enum_parameters.RequestQueryParameters.Params) | | +[header_params](#enum_parameters.RequestHeaderParameters) | [RequestHeaderParameters.Params](#enum_parameters.RequestHeaderParameters.Params) | | content_type | str | optional, default is 'application/x-www-form-urlencoded' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationXWwwFormUrlencoded +# RequestBody.Schemas.application_x_www_form_urlencoded ## Model Type Info Input Type | Accessed Type | Description | Notes @@ -1131,18 +1112,18 @@ Class Name | Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- | ------------- items | str, | str, | | must be one of [">", "$", ] if omitted the server will use the default value of "$" -### query_params -#### RequestQueryParams +### query_params +#### RequestQueryParameters.Params -Name | Type | Description | Notes +Key | Input Type | Description | Notes ------------- | ------------- | ------------- | ------------- -enum_query_string_array | EnumQueryStringArraySchema | | optional -enum_query_string | EnumQueryStringSchema | | optional -enum_query_integer | EnumQueryIntegerSchema | | optional -enum_query_double | EnumQueryDoubleSchema | | optional +enum_query_string_array | [RequestQueryParameters.Schemas.enum_query_string_array](#enum_parameters.RequestQueryParameters.Schemas.enum_query_string_array) | | optional +enum_query_string | [RequestQueryParameters.Schemas.enum_query_string](#enum_parameters.RequestQueryParameters.Schemas.enum_query_string) | | optional +enum_query_integer | [RequestQueryParameters.Schemas.enum_query_integer](#enum_parameters.RequestQueryParameters.Schemas.enum_query_integer) | | optional +enum_query_double | [RequestQueryParameters.Schemas.enum_query_double](#enum_parameters.RequestQueryParameters.Schemas.enum_query_double) | | optional -# EnumQueryStringArraySchema +# RequestQueryParameters.Schemas.enum_query_string_array ## Model Type Info Input Type | Accessed Type | Description | Notes @@ -1154,36 +1135,36 @@ Class Name | Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- | ------------- items | str, | str, | | must be one of [">", "$", ] if omitted the server will use the default value of "$" -# EnumQueryStringSchema +# RequestQueryParameters.Schemas.enum_query_string ## Model Type Info Input Type | Accessed Type | Description | Notes ------------ | ------------- | ------------- | ------------- str, | str, | | must be one of ["_abc", "-efg", "(xyz)", ] if omitted the server will use the default value of "-efg" -# EnumQueryIntegerSchema +# RequestQueryParameters.Schemas.enum_query_integer ## Model Type Info Input Type | Accessed Type | Description | Notes ------------ | ------------- | ------------- | ------------- decimal.Decimal, int, | decimal.Decimal, | | must be one of [1, -2, ] value must be a 32 bit integer -# EnumQueryDoubleSchema +# RequestQueryParameters.Schemas.enum_query_double ## Model Type Info Input Type | Accessed Type | Description | Notes ------------ | ------------- | ------------- | ------------- decimal.Decimal, int, float, | decimal.Decimal, | | must be one of [1.1, -1.2, ] value must be a 64 bit float -### header_params -#### RequestHeaderParams +### header_params +#### RequestHeaderParameters.Params -Name | Type | Description | Notes +Key | Input Type | Description | Notes ------------- | ------------- | ------------- | ------------- -enum_header_string_array | EnumHeaderStringArraySchema | | optional -enum_header_string | EnumHeaderStringSchema | | optional +enum_header_string_array | [RequestHeaderParameters.Schemas.enum_header_string_array](#enum_parameters.RequestHeaderParameters.Schemas.enum_header_string_array) | | optional +enum_header_string | [RequestHeaderParameters.Schemas.enum_header_string](#enum_parameters.RequestHeaderParameters.Schemas.enum_header_string) | | optional -# EnumHeaderStringArraySchema +# RequestHeaderParameters.Schemas.enum_header_string_array ## Model Type Info Input Type | Accessed Type | Description | Notes @@ -1195,7 +1176,7 @@ Class Name | Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- | ------------- items | str, | str, | | must be one of [">", "$", ] if omitted the server will use the default value of "$" -# EnumHeaderStringSchema +# RequestHeaderParameters.Schemas.enum_header_string ## Model Type Info Input Type | Accessed Type | Description | Notes @@ -1207,17 +1188,17 @@ str, | str, | | must be one of ["_abc", "-efg", "(xyz)", ] if omitted the ser Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#enum_parameters.ApiResponseFor200) | Success -404 | [ApiResponseFor404](#enum_parameters.ApiResponseFor404) | Not found +200 | [response_for_200.ApiResponse](#enum_parameters.response_for_200.ApiResponse) | Success +404 | [response_for_404.ApiResponse](#enum_parameters.response_for_404.ApiResponse) | Not found -#### enum_parameters.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | body | Unset | body was not defined | headers | Unset | headers were not defined | -#### enum_parameters.ApiResponseFor404 +#### response_for_404.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -1232,7 +1213,6 @@ No authorization required # **fake_health_get** -> HealthCheckResult fake_health_get() Health check endpoint @@ -1241,7 +1221,6 @@ Health check endpoint ```python import petstore_api from petstore_api.apis.tags import fake_api -from petstore_api.model.health_check_result import HealthCheckResult 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. @@ -1270,16 +1249,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#fake_health_get.ApiResponseFor200) | The instance started successfully +200 | [response_for_200.ApiResponse](#fake_health_get.response_for_200.ApiResponse) | The instance started successfully -#### fake_health_get.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#fake_health_get.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**HealthCheckResult**](../../models/HealthCheckResult.md) | | @@ -1293,7 +1272,6 @@ No authorization required # **group_parameters** -> group_parameters(required_string_grouprequired_boolean_grouprequired_int64_group) Fake endpoint to test group parameters (optional) @@ -1367,67 +1345,67 @@ with petstore_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -query_params | RequestQueryParams | | -header_params | RequestHeaderParams | | +[query_params](#group_parameters.RequestQueryParameters) | [RequestQueryParameters.Params](#group_parameters.RequestQueryParameters.Params) | | +[header_params](#group_parameters.RequestHeaderParameters) | [RequestHeaderParameters.Params](#group_parameters.RequestHeaderParameters.Params) | | stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### query_params -#### RequestQueryParams +### query_params +#### RequestQueryParameters.Params -Name | Type | Description | Notes +Key | Input Type | Description | Notes ------------- | ------------- | ------------- | ------------- -required_string_group | RequiredStringGroupSchema | | -required_int64_group | RequiredInt64GroupSchema | | -string_group | StringGroupSchema | | optional -int64_group | Int64GroupSchema | | optional +required_string_group | [RequestQueryParameters.Schemas.required_string_group](#group_parameters.RequestQueryParameters.Schemas.required_string_group) | | +required_int64_group | [RequestQueryParameters.Schemas.required_int64_group](#group_parameters.RequestQueryParameters.Schemas.required_int64_group) | | +string_group | [RequestQueryParameters.Schemas.string_group](#group_parameters.RequestQueryParameters.Schemas.string_group) | | optional +int64_group | [RequestQueryParameters.Schemas.int64_group](#group_parameters.RequestQueryParameters.Schemas.int64_group) | | optional -# RequiredStringGroupSchema +# RequestQueryParameters.Schemas.required_string_group ## Model Type Info Input Type | Accessed Type | Description | Notes ------------ | ------------- | ------------- | ------------- decimal.Decimal, int, | decimal.Decimal, | | -# RequiredInt64GroupSchema +# RequestQueryParameters.Schemas.required_int64_group ## Model Type Info Input Type | Accessed Type | Description | Notes ------------ | ------------- | ------------- | ------------- decimal.Decimal, int, | decimal.Decimal, | | value must be a 64 bit integer -# StringGroupSchema +# RequestQueryParameters.Schemas.string_group ## Model Type Info Input Type | Accessed Type | Description | Notes ------------ | ------------- | ------------- | ------------- decimal.Decimal, int, | decimal.Decimal, | | -# Int64GroupSchema +# RequestQueryParameters.Schemas.int64_group ## Model Type Info Input Type | Accessed Type | Description | Notes ------------ | ------------- | ------------- | ------------- decimal.Decimal, int, | decimal.Decimal, | | value must be a 64 bit integer -### header_params -#### RequestHeaderParams +### header_params +#### RequestHeaderParameters.Params -Name | Type | Description | Notes +Key | Input Type | Description | Notes ------------- | ------------- | ------------- | ------------- -required_boolean_group | RequiredBooleanGroupSchema | | -boolean_group | BooleanGroupSchema | | optional +required_boolean_group | [RequestHeaderParameters.Schemas.required_boolean_group](#group_parameters.RequestHeaderParameters.Schemas.required_boolean_group) | | +boolean_group | [RequestHeaderParameters.Schemas.boolean_group](#group_parameters.RequestHeaderParameters.Schemas.boolean_group) | | optional -# RequiredBooleanGroupSchema +# RequestHeaderParameters.Schemas.required_boolean_group ## Model Type Info Input Type | Accessed Type | Description | Notes ------------ | ------------- | ------------- | ------------- bool, | BoolClass, | | -# BooleanGroupSchema +# RequestHeaderParameters.Schemas.boolean_group ## Model Type Info Input Type | Accessed Type | Description | Notes @@ -1439,9 +1417,9 @@ bool, | BoolClass, | | Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#group_parameters.ApiResponseFor200) | succeeded +200 | [response_for_200.ApiResponse](#group_parameters.response_for_200.ApiResponse) | succeeded -#### group_parameters.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -1456,7 +1434,6 @@ headers | Unset | headers were not defined | # **inline_additional_properties** -> inline_additional_properties(request_body) test inline additionalProperties @@ -1493,15 +1470,15 @@ with petstore_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#inline_additional_properties.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#inline_additional_properties.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json ## Model Type Info Input Type | Accessed Type | Description | Notes @@ -1518,9 +1495,9 @@ Key | Input Type | Accessed Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#inline_additional_properties.ApiResponseFor200) | successful operation +200 | [response_for_200.ApiResponse](#inline_additional_properties.response_for_200.ApiResponse) | successful operation -#### inline_additional_properties.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -1535,7 +1512,6 @@ No authorization required # **inline_composition** -> bool, date, datetime, dict, float, int, list, str, none_type inline_composition() testing composed schemas at inline locations @@ -1578,17 +1554,17 @@ with petstore_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson, SchemaForRequestBodyMultipartFormData, Unset] | optional, default is unset | -query_params | RequestQueryParams | | +[body](#inline_composition.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#inline_composition.RequestBody.Schemas.application_json), [RequestBody.Schemas.multipart_form_data](#inline_composition.RequestBody.Schemas.multipart_form_data), Unset] | optional, default is unset | +[query_params](#inline_composition.RequestQueryParameters) | [RequestQueryParameters.Params](#inline_composition.RequestQueryParameters.Params) | | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body accept_content_types | typing.Tuple[str] | default is ('application/json', 'multipart/form-data', ) | Tells the server the content type(s) that are accepted by the client stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json ## Model Type Info Input Type | Accessed Type | Description | Notes @@ -1608,7 +1584,7 @@ Input Type | Accessed Type | Description | Notes ------------ | ------------- | ------------- | ------------- str, | str, | | -# SchemaForRequestBodyMultipartFormData +# RequestBody.Schemas.multipart_form_data ## Model Type Info Input Type | Accessed Type | Description | Notes @@ -1641,16 +1617,16 @@ Input Type | Accessed Type | Description | Notes ------------ | ------------- | ------------- | ------------- str, | str, | | -### query_params -#### RequestQueryParams +### query_params +#### RequestQueryParameters.Params -Name | Type | Description | Notes +Key | Input Type | Description | Notes ------------- | ------------- | ------------- | ------------- -compositionAtRoot | CompositionAtRootSchema | | optional -compositionInProperty | CompositionInPropertySchema | | optional +compositionAtRoot | [RequestQueryParameters.Schemas.compositionAtRoot](#inline_composition.RequestQueryParameters.Schemas.compositionAtRoot) | | optional +compositionInProperty | [RequestQueryParameters.Schemas.compositionInProperty](#inline_composition.RequestQueryParameters.Schemas.compositionInProperty) | | optional -# CompositionAtRootSchema +# RequestQueryParameters.Schemas.compositionAtRoot ## Model Type Info Input Type | Accessed Type | Description | Notes @@ -1670,7 +1646,7 @@ Input Type | Accessed Type | Description | Notes ------------ | ------------- | ------------- | ------------- str, | str, | | -# CompositionInPropertySchema +# RequestQueryParameters.Schemas.compositionInProperty ## Model Type Info Input Type | Accessed Type | Description | Notes @@ -1708,16 +1684,16 @@ str, | str, | | Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#inline_composition.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#inline_composition.response_for_200.ApiResponse) | success -#### inline_composition.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, SchemaFor200ResponseBodyMultipartFormData, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#inline_composition.response_for_200.BodySchemas.application_json), [response_for_200.BodySchemas.multipart_form_data](#inline_composition.response_for_200.BodySchemas.multipart_form_data), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json ## Model Type Info Input Type | Accessed Type | Description | Notes @@ -1737,7 +1713,7 @@ Input Type | Accessed Type | Description | Notes ------------ | ------------- | ------------- | ------------- str, | str, | | -# SchemaFor200ResponseBodyMultipartFormData +# response_for_200.BodySchemas.multipart_form_data ## Model Type Info Input Type | Accessed Type | Description | Notes @@ -1778,7 +1754,6 @@ No authorization required # **json_form_data** -> json_form_data() test json serialization of form data @@ -1816,15 +1791,15 @@ with petstore_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, Unset] | optional, default is unset | +[body](#json_form_data.RequestBody) | typing.Union[[RequestBody.Schemas.application_x_www_form_urlencoded](#json_form_data.RequestBody.Schemas.application_x_www_form_urlencoded), Unset] | optional, default is unset | content_type | str | optional, default is 'application/x-www-form-urlencoded' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationXWwwFormUrlencoded +# RequestBody.Schemas.application_x_www_form_urlencoded ## Model Type Info Input Type | Accessed Type | Description | Notes @@ -1843,9 +1818,9 @@ Key | Input Type | Accessed Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#json_form_data.ApiResponseFor200) | successful operation +200 | [response_for_200.ApiResponse](#json_form_data.response_for_200.ApiResponse) | successful operation -#### json_form_data.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -1860,7 +1835,6 @@ No authorization required # **json_patch** -> json_patch() json patch @@ -1900,15 +1874,15 @@ with petstore_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJsonPatchjson, Unset] | optional, default is unset | +[body](#json_patch.RequestBody) | typing.Union[[RequestBody.Schemas.application_json_patchjson](#json_patch.RequestBody.Schemas.application_json_patchjson), Unset] | optional, default is unset | content_type | str | optional, default is 'application/json-patch+json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJsonPatchjson +# RequestBody.Schemas.application_json_patchjson Type | Description | Notes ------------- | ------------- | ------------- [**JSONPatchRequest**](../../models/JSONPatchRequest.md) | | @@ -1919,9 +1893,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#json_patch.ApiResponseFor200) | OK +200 | [response_for_200.ApiResponse](#json_patch.response_for_200.ApiResponse) | OK -#### json_patch.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -1936,7 +1910,6 @@ No authorization required # **json_with_charset** -> bool, date, datetime, dict, float, int, list, str, none_type json_with_charset() json with charset tx and rx @@ -1972,16 +1945,16 @@ with petstore_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJsonCharsetutf8, Unset] | optional, default is unset | +[body](#json_with_charset.RequestBody) | typing.Union[[RequestBody.Schemas.application_json_charsetutf_8](#json_with_charset.RequestBody.Schemas.application_json_charsetutf_8), Unset] | optional, default is unset | content_type | str | optional, default is 'application/json; charset=utf-8' | Selects the schema and serialization of the request body accept_content_types | typing.Tuple[str] | default is ('application/json; charset=utf-8', ) | Tells the server the content type(s) that are accepted by the client stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJsonCharsetutf8 +# RequestBody.Schemas.application_json_charsetutf_8 ## Model Type Info Input Type | Accessed Type | Description | Notes @@ -1993,16 +1966,16 @@ dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#json_with_charset.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#json_with_charset.response_for_200.ApiResponse) | success -#### json_with_charset.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJsonCharsetutf8, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json_charsetutf_8](#json_with_charset.response_for_200.BodySchemas.application_json_charsetutf_8), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJsonCharsetutf8 +# response_for_200.BodySchemas.application_json_charsetutf_8 ## Model Type Info Input Type | Accessed Type | Description | Notes @@ -2017,8 +1990,6 @@ No authorization required # **mammal** -> Mammal mammal(mammal) - Test serialization of mammals @@ -2059,16 +2030,16 @@ with petstore_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#mammal.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#mammal.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body accept_content_types | typing.Tuple[str] | default is ('application/json', ) | Tells the server the content type(s) that are accepted by the client stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**Mammal**](../../models/Mammal.md) | | @@ -2079,16 +2050,16 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#mammal.ApiResponseFor200) | Output mammal +200 | [response_for_200.ApiResponse](#mammal.response_for_200.ApiResponse) | Output mammal -#### mammal.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#mammal.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**Mammal**](../../models/Mammal.md) | | @@ -2102,8 +2073,6 @@ No authorization required # **number_with_validations** -> NumberWithValidations number_with_validations() - Test serialization of outer number types @@ -2140,16 +2109,16 @@ with petstore_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson, Unset] | optional, default is unset | +[body](#number_with_validations.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#number_with_validations.RequestBody.Schemas.application_json), Unset] | optional, default is unset | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body accept_content_types | typing.Tuple[str] | default is ('application/json', ) | Tells the server the content type(s) that are accepted by the client stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**NumberWithValidations**](../../models/NumberWithValidations.md) | | @@ -2160,16 +2129,16 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#number_with_validations.ApiResponseFor200) | Output number +200 | [response_for_200.ApiResponse](#number_with_validations.response_for_200.ApiResponse) | Output number -#### number_with_validations.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#number_with_validations.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**NumberWithValidations**](../../models/NumberWithValidations.md) | | @@ -2183,7 +2152,6 @@ No authorization required # **object_in_query** -> object_in_query() user list @@ -2222,20 +2190,20 @@ with petstore_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -query_params | RequestQueryParams | | +[query_params](#object_in_query.RequestQueryParameters) | [RequestQueryParameters.Params](#object_in_query.RequestQueryParameters.Params) | | stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### query_params -#### RequestQueryParams +### query_params +#### RequestQueryParameters.Params -Name | Type | Description | Notes +Key | Input Type | Description | Notes ------------- | ------------- | ------------- | ------------- -mapBean | MapBeanSchema | | optional +mapBean | [RequestQueryParameters.Schemas.mapBean](#object_in_query.RequestQueryParameters.Schemas.mapBean) | | optional -# MapBeanSchema +# RequestQueryParameters.Schemas.mapBean ## Model Type Info Input Type | Accessed Type | Description | Notes @@ -2253,9 +2221,9 @@ Key | Input Type | Accessed Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#object_in_query.ApiResponseFor200) | ok +200 | [response_for_200.ApiResponse](#object_in_query.response_for_200.ApiResponse) | ok -#### object_in_query.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -2270,8 +2238,6 @@ No authorization required # **object_model_with_ref_props** -> ObjectModelWithRefProps object_model_with_ref_props() - Test serialization of object with $refed properties @@ -2297,8 +2263,8 @@ with petstore_api.ApiClient(configuration) as api_client: # example passing only optional values body = ObjectModelWithRefProps( my_number=NumberWithValidations(10), - my_string="my_string_example", - my_boolean=True, + my_string=String("my_string_example"), + my_boolean=Boolean(True), ) try: api_response = api_instance.object_model_with_ref_props( @@ -2312,16 +2278,16 @@ with petstore_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson, Unset] | optional, default is unset | +[body](#object_model_with_ref_props.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#object_model_with_ref_props.RequestBody.Schemas.application_json), Unset] | optional, default is unset | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body accept_content_types | typing.Tuple[str] | default is ('application/json', ) | Tells the server the content type(s) that are accepted by the client stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**ObjectModelWithRefProps**](../../models/ObjectModelWithRefProps.md) | | @@ -2332,16 +2298,16 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#object_model_with_ref_props.ApiResponseFor200) | Output model +200 | [response_for_200.ApiResponse](#object_model_with_ref_props.response_for_200.ApiResponse) | Output model -#### object_model_with_ref_props.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#object_model_with_ref_props.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**ObjectModelWithRefProps**](../../models/ObjectModelWithRefProps.md) | | @@ -2355,7 +2321,6 @@ No authorization required # **parameter_collisions** -> bool, date, datetime, dict, float, int, list, str, none_type parameter_collisions(_3a_b5ab2_self3a_b6) parameter collision case @@ -2448,197 +2413,197 @@ with petstore_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson, Unset] | optional, default is unset | -query_params | RequestQueryParams | | -header_params | RequestHeaderParams | | -path_params | RequestPathParams | | -cookie_params | RequestCookieParams | | +[body](#parameter_collisions.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#parameter_collisions.RequestBody.Schemas.application_json), Unset] | optional, default is unset | +[query_params](#parameter_collisions.RequestQueryParameters) | [RequestQueryParameters.Params](#parameter_collisions.RequestQueryParameters.Params) | | +[header_params](#parameter_collisions.RequestHeaderParameters) | [RequestHeaderParameters.Params](#parameter_collisions.RequestHeaderParameters.Params) | | +[path_params](#parameter_collisions.RequestPathParameters) | [RequestPathParameters.Params](#parameter_collisions.RequestPathParameters.Params) | | +[cookie_params](#parameter_collisions.RequestCookieParameters) | [RequestCookieParameters.Params](#parameter_collisions.RequestCookieParameters.Params) | | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body accept_content_types | typing.Tuple[str] | default is ('application/json', ) | Tells the server the content type(s) that are accepted by the client stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json ## Model Type Info Input Type | Accessed Type | Description | Notes ------------ | ------------- | ------------- | ------------- dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, | frozendict.frozendict, str, decimal.Decimal, BoolClass, NoneClass, tuple, bytes, FileIO | | -### query_params -#### RequestQueryParams +### query_params +#### RequestQueryParameters.Params -Name | Type | Description | Notes +Key | Input Type | Description | Notes ------------- | ------------- | ------------- | ------------- -1 | Model1Schema | | optional -aB | ABSchema | | optional -Ab | AbSchema | | optional -self | ModelSelfSchema | | optional -A-B | ABSchema | | optional +1 | [RequestQueryParameters.Schemas._1](#parameter_collisions.RequestQueryParameters.Schemas._1) | | optional +aB | [RequestQueryParameters.Schemas.aB](#parameter_collisions.RequestQueryParameters.Schemas.aB) | | optional +Ab | [RequestQueryParameters.Schemas.Ab](#parameter_collisions.RequestQueryParameters.Schemas.Ab) | | optional +self | [RequestQueryParameters.Schemas._self](#parameter_collisions.RequestQueryParameters.Schemas._self) | | optional +A-B | [RequestQueryParameters.Schemas.a_b](#parameter_collisions.RequestQueryParameters.Schemas.a_b) | | optional -# Model1Schema +# RequestQueryParameters.Schemas._1 ## Model Type Info Input Type | Accessed Type | Description | Notes ------------ | ------------- | ------------- | ------------- str, | str, | | -# ABSchema +# RequestQueryParameters.Schemas.aB ## Model Type Info Input Type | Accessed Type | Description | Notes ------------ | ------------- | ------------- | ------------- str, | str, | | -# AbSchema +# RequestQueryParameters.Schemas.Ab ## Model Type Info Input Type | Accessed Type | Description | Notes ------------ | ------------- | ------------- | ------------- str, | str, | | -# ModelSelfSchema +# RequestQueryParameters.Schemas._self ## Model Type Info Input Type | Accessed Type | Description | Notes ------------ | ------------- | ------------- | ------------- str, | str, | | -# ABSchema +# RequestQueryParameters.Schemas.a_b ## Model Type Info Input Type | Accessed Type | Description | Notes ------------ | ------------- | ------------- | ------------- str, | str, | | -### header_params -#### RequestHeaderParams +### header_params +#### RequestHeaderParameters.Params -Name | Type | Description | Notes +Key | Input Type | Description | Notes ------------- | ------------- | ------------- | ------------- -1 | Model1Schema | | optional -aB | ABSchema | | optional -self | ModelSelfSchema | | optional -A-B | ABSchema | | optional +1 | [RequestHeaderParameters.Schemas._1](#parameter_collisions.RequestHeaderParameters.Schemas._1) | | optional +aB | [RequestHeaderParameters.Schemas.aB](#parameter_collisions.RequestHeaderParameters.Schemas.aB) | | optional +self | [RequestHeaderParameters.Schemas._self](#parameter_collisions.RequestHeaderParameters.Schemas._self) | | optional +A-B | [RequestHeaderParameters.Schemas.a_b](#parameter_collisions.RequestHeaderParameters.Schemas.a_b) | | optional -# Model1Schema +# RequestHeaderParameters.Schemas._1 ## Model Type Info Input Type | Accessed Type | Description | Notes ------------ | ------------- | ------------- | ------------- str, | str, | | -# ABSchema +# RequestHeaderParameters.Schemas.aB ## Model Type Info Input Type | Accessed Type | Description | Notes ------------ | ------------- | ------------- | ------------- str, | str, | | -# ModelSelfSchema +# RequestHeaderParameters.Schemas._self ## Model Type Info Input Type | Accessed Type | Description | Notes ------------ | ------------- | ------------- | ------------- str, | str, | | -# ABSchema +# RequestHeaderParameters.Schemas.a_b ## Model Type Info Input Type | Accessed Type | Description | Notes ------------ | ------------- | ------------- | ------------- str, | str, | | -### path_params -#### RequestPathParams +### path_params +#### RequestPathParameters.Params -Name | Type | Description | Notes +Key | Input Type | Description | Notes ------------- | ------------- | ------------- | ------------- -1 | Model1Schema | | -aB | ABSchema | | -Ab | AbSchema | | -self | ModelSelfSchema | | -A-B | ABSchema | | +1 | [RequestPathParameters.Schemas._1](#parameter_collisions.RequestPathParameters.Schemas._1) | | +aB | [RequestPathParameters.Schemas.aB](#parameter_collisions.RequestPathParameters.Schemas.aB) | | +Ab | [RequestPathParameters.Schemas.Ab](#parameter_collisions.RequestPathParameters.Schemas.Ab) | | +self | [RequestPathParameters.Schemas._self](#parameter_collisions.RequestPathParameters.Schemas._self) | | +A-B | [RequestPathParameters.Schemas.a_b](#parameter_collisions.RequestPathParameters.Schemas.a_b) | | -# Model1Schema +# RequestPathParameters.Schemas._1 ## Model Type Info Input Type | Accessed Type | Description | Notes ------------ | ------------- | ------------- | ------------- str, | str, | | -# ABSchema +# RequestPathParameters.Schemas.aB ## Model Type Info Input Type | Accessed Type | Description | Notes ------------ | ------------- | ------------- | ------------- str, | str, | | -# AbSchema +# RequestPathParameters.Schemas.Ab ## Model Type Info Input Type | Accessed Type | Description | Notes ------------ | ------------- | ------------- | ------------- str, | str, | | -# ModelSelfSchema +# RequestPathParameters.Schemas._self ## Model Type Info Input Type | Accessed Type | Description | Notes ------------ | ------------- | ------------- | ------------- str, | str, | | -# ABSchema +# RequestPathParameters.Schemas.a_b ## Model Type Info Input Type | Accessed Type | Description | Notes ------------ | ------------- | ------------- | ------------- str, | str, | | -### cookie_params -#### RequestCookieParams +### cookie_params +#### RequestCookieParameters.Params -Name | Type | Description | Notes +Key | Input Type | Description | Notes ------------- | ------------- | ------------- | ------------- -1 | Model1Schema | | optional -aB | ABSchema | | optional -Ab | AbSchema | | optional -self | ModelSelfSchema | | optional -A-B | ABSchema | | optional +1 | [RequestCookieParameters.Schemas._1](#parameter_collisions.RequestCookieParameters.Schemas._1) | | optional +aB | [RequestCookieParameters.Schemas.aB](#parameter_collisions.RequestCookieParameters.Schemas.aB) | | optional +Ab | [RequestCookieParameters.Schemas.Ab](#parameter_collisions.RequestCookieParameters.Schemas.Ab) | | optional +self | [RequestCookieParameters.Schemas._self](#parameter_collisions.RequestCookieParameters.Schemas._self) | | optional +A-B | [RequestCookieParameters.Schemas.a_b](#parameter_collisions.RequestCookieParameters.Schemas.a_b) | | optional -# Model1Schema +# RequestCookieParameters.Schemas._1 ## Model Type Info Input Type | Accessed Type | Description | Notes ------------ | ------------- | ------------- | ------------- str, | str, | | -# ABSchema +# RequestCookieParameters.Schemas.aB ## Model Type Info Input Type | Accessed Type | Description | Notes ------------ | ------------- | ------------- | ------------- str, | str, | | -# AbSchema +# RequestCookieParameters.Schemas.Ab ## Model Type Info Input Type | Accessed Type | Description | Notes ------------ | ------------- | ------------- | ------------- str, | str, | | -# ModelSelfSchema +# RequestCookieParameters.Schemas._self ## Model Type Info Input Type | Accessed Type | Description | Notes ------------ | ------------- | ------------- | ------------- str, | str, | | -# ABSchema +# RequestCookieParameters.Schemas.a_b ## Model Type Info Input Type | Accessed Type | Description | Notes @@ -2650,16 +2615,16 @@ str, | str, | | Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#parameter_collisions.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#parameter_collisions.response_for_200.ApiResponse) | success -#### parameter_collisions.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#parameter_collisions.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json ## Model Type Info Input Type | Accessed Type | Description | Notes @@ -2674,7 +2639,6 @@ No authorization required # **query_param_with_json_content_type** -> bool, date, datetime, dict, float, int, list, str, none_type query_param_with_json_content_type(some_param) query param with json content-type @@ -2712,16 +2676,16 @@ with petstore_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -query_params | RequestQueryParams | | +[query_params](#query_param_with_json_content_type.RequestQueryParameters) | [RequestQueryParameters.Params](#query_param_with_json_content_type.RequestQueryParameters.Params) | | accept_content_types | typing.Tuple[str] | default is ('application/json', ) | Tells the server the content type(s) that are accepted by the client stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### query_params -#### RequestQueryParams +### query_params +#### RequestQueryParameters.Params -Name | Type | Description | Notes +Key | Input Type | Description | Notes ------------- | ------------- | ------------- | ------------- someParam | | | @@ -2731,16 +2695,16 @@ someParam | | | Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#query_param_with_json_content_type.ApiResponseFor200) | success +200 | [response_for_200.ApiResponse](#query_param_with_json_content_type.response_for_200.ApiResponse) | success -#### query_param_with_json_content_type.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#query_param_with_json_content_type.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json ## Model Type Info Input Type | Accessed Type | Description | Notes @@ -2755,8 +2719,6 @@ No authorization required # **query_parameter_collection_format** -> query_parameter_collection_format(pipeioutilhttpurlcontextref_param) - To test the collection format in query parameters @@ -2809,25 +2771,25 @@ with petstore_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -query_params | RequestQueryParams | | +[query_params](#query_parameter_collection_format.RequestQueryParameters) | [RequestQueryParameters.Params](#query_parameter_collection_format.RequestQueryParameters.Params) | | stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### query_params -#### RequestQueryParams +### query_params +#### RequestQueryParameters.Params -Name | Type | Description | Notes +Key | Input Type | Description | Notes ------------- | ------------- | ------------- | ------------- -pipe | PipeSchema | | -ioutil | IoutilSchema | | -http | HttpSchema | | -url | UrlSchema | | -context | ContextSchema | | -refParam | RefParamSchema | | +pipe | [RequestQueryParameters.Schemas.pipe](#query_parameter_collection_format.RequestQueryParameters.Schemas.pipe) | | +ioutil | [RequestQueryParameters.Schemas.ioutil](#query_parameter_collection_format.RequestQueryParameters.Schemas.ioutil) | | +http | [RequestQueryParameters.Schemas.http](#query_parameter_collection_format.RequestQueryParameters.Schemas.http) | | +url | [RequestQueryParameters.Schemas.url](#query_parameter_collection_format.RequestQueryParameters.Schemas.url) | | +context | [RequestQueryParameters.Schemas.context](#query_parameter_collection_format.RequestQueryParameters.Schemas.context) | | +refParam | [RequestQueryParameters.Schemas.refParam](#query_parameter_collection_format.RequestQueryParameters.Schemas.refParam) | | -# PipeSchema +# RequestQueryParameters.Schemas.pipe ## Model Type Info Input Type | Accessed Type | Description | Notes @@ -2839,7 +2801,7 @@ Class Name | Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- | ------------- items | str, | str, | | -# IoutilSchema +# RequestQueryParameters.Schemas.ioutil ## Model Type Info Input Type | Accessed Type | Description | Notes @@ -2851,7 +2813,7 @@ Class Name | Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- | ------------- items | str, | str, | | -# HttpSchema +# RequestQueryParameters.Schemas.http ## Model Type Info Input Type | Accessed Type | Description | Notes @@ -2863,7 +2825,7 @@ Class Name | Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- | ------------- items | str, | str, | | -# UrlSchema +# RequestQueryParameters.Schemas.url ## Model Type Info Input Type | Accessed Type | Description | Notes @@ -2875,7 +2837,7 @@ Class Name | Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- | ------------- items | str, | str, | | -# ContextSchema +# RequestQueryParameters.Schemas.context ## Model Type Info Input Type | Accessed Type | Description | Notes @@ -2887,7 +2849,7 @@ Class Name | Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- | ------------- items | str, | str, | | -# RefParamSchema +# RequestQueryParameters.Schemas.refParam Type | Description | Notes ------------- | ------------- | ------------- [**StringWithValidation**](../../models/StringWithValidation.md) | | @@ -2898,9 +2860,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#query_parameter_collection_format.ApiResponseFor200) | Success +200 | [response_for_200.ApiResponse](#query_parameter_collection_format.response_for_200.ApiResponse) | Success -#### query_parameter_collection_format.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -2915,7 +2877,6 @@ No authorization required # **ref_object_in_query** -> ref_object_in_query() user list @@ -2940,7 +2901,7 @@ with petstore_api.ApiClient(configuration) as api_client: # example passing only optional values query_params = { 'mapBean': Foo( - bar="bar", + bar=Bar("bar"), ), } try: @@ -2955,20 +2916,20 @@ with petstore_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -query_params | RequestQueryParams | | +[query_params](#ref_object_in_query.RequestQueryParameters) | [RequestQueryParameters.Params](#ref_object_in_query.RequestQueryParameters.Params) | | stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### query_params -#### RequestQueryParams +### query_params +#### RequestQueryParameters.Params -Name | Type | Description | Notes +Key | Input Type | Description | Notes ------------- | ------------- | ------------- | ------------- -mapBean | MapBeanSchema | | optional +mapBean | [RequestQueryParameters.Schemas.mapBean](#ref_object_in_query.RequestQueryParameters.Schemas.mapBean) | | optional -# MapBeanSchema +# RequestQueryParameters.Schemas.mapBean Type | Description | Notes ------------- | ------------- | ------------- [**Foo**](../../models/Foo.md) | | @@ -2979,9 +2940,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#ref_object_in_query.ApiResponseFor200) | ok +200 | [response_for_200.ApiResponse](#ref_object_in_query.response_for_200.ApiResponse) | ok -#### ref_object_in_query.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -2996,7 +2957,6 @@ No authorization required # **response_without_schema** -> response_without_schema() receives a response without schema @@ -3032,9 +2992,9 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#response_without_schema.ApiResponseFor200) | contents without schema definition +200 | [response_for_200.ApiResponse](#response_without_schema.response_for_200.ApiResponse) | contents without schema definition -#### response_without_schema.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -3049,8 +3009,6 @@ No authorization required # **string** -> str string() - Test serialization of outer string types @@ -3060,6 +3018,7 @@ Test serialization of outer string types ```python import petstore_api from petstore_api.apis.tags import fake_api +from petstore_api.model.string import String 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. @@ -3073,7 +3032,7 @@ with petstore_api.ApiClient(configuration) as api_client: api_instance = fake_api.FakeApi(api_client) # example passing only optional values - body = "body_example" + body = String("body_example") try: api_response = api_instance.string( body=body, @@ -3086,42 +3045,40 @@ with petstore_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson, Unset] | optional, default is unset | +[body](#string.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#string.RequestBody.Schemas.application_json), Unset] | optional, default is unset | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body accept_content_types | typing.Tuple[str] | default is ('application/json', ) | Tells the server the content type(s) that are accepted by the client stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**String**](../../models/String.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -str, | str, | | ### Return Types, Responses Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#string.ApiResponseFor200) | Output string +200 | [response_for_200.ApiResponse](#string.response_for_200.ApiResponse) | Output string -#### string.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#string.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json +Type | Description | Notes +------------- | ------------- | ------------- +[**String**](../../models/String.md) | | -## Model Type Info -Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- -str, | str, | | ### Authorization @@ -3131,8 +3088,6 @@ No authorization required # **string_enum** -> StringEnum string_enum() - Test serialization of outer enum @@ -3169,16 +3124,16 @@ with petstore_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson, Unset] | optional, default is unset | +[body](#string_enum.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#string_enum.RequestBody.Schemas.application_json), Unset] | optional, default is unset | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body accept_content_types | typing.Tuple[str] | default is ('application/json', ) | Tells the server the content type(s) that are accepted by the client stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**StringEnum**](../../models/StringEnum.md) | | @@ -3189,16 +3144,16 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#string_enum.ApiResponseFor200) | Output enum +200 | [response_for_200.ApiResponse](#string_enum.response_for_200.ApiResponse) | Output enum -#### string_enum.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#string_enum.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**StringEnum**](../../models/StringEnum.md) | | @@ -3212,7 +3167,6 @@ No authorization required # **upload_download_file** -> file_type upload_download_file(body) uploads a file and downloads a file using application/octet-stream @@ -3248,16 +3202,16 @@ with petstore_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationOctetStream] | required | +[body](#upload_download_file.RequestBody) | typing.Union[[RequestBody.Schemas.application_octet_stream](#upload_download_file.RequestBody.Schemas.application_octet_stream)] | required | content_type | str | optional, default is 'application/octet-stream' | Selects the schema and serialization of the request body accept_content_types | typing.Tuple[str] | default is ('application/octet-stream', ) | Tells the server the content type(s) that are accepted by the client stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationOctetStream +# RequestBody.Schemas.application_octet_stream file to upload @@ -3271,16 +3225,16 @@ bytes, io.FileIO, io.BufferedReader, | bytes, FileIO, | file to upload | Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#upload_download_file.ApiResponseFor200) | successful operation +200 | [response_for_200.ApiResponse](#upload_download_file.response_for_200.ApiResponse) | successful operation -#### upload_download_file.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationOctetStream, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_octet_stream](#upload_download_file.response_for_200.BodySchemas.application_octet_stream), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationOctetStream +# response_for_200.BodySchemas.application_octet_stream file to download @@ -3297,7 +3251,6 @@ No authorization required # **upload_file** -> ApiResponse upload_file() uploads a file using multipart/form-data @@ -3306,7 +3259,6 @@ uploads a file using multipart/form-data ```python import petstore_api from petstore_api.apis.tags import fake_api -from petstore_api.model.api_response import ApiResponse 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. @@ -3337,16 +3289,16 @@ with petstore_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyMultipartFormData, Unset] | optional, default is unset | +[body](#upload_file.RequestBody) | typing.Union[[RequestBody.Schemas.multipart_form_data](#upload_file.RequestBody.Schemas.multipart_form_data), Unset] | optional, default is unset | content_type | str | optional, default is 'multipart/form-data' | Selects the schema and serialization of the request body accept_content_types | typing.Tuple[str] | default is ('application/json', ) | Tells the server the content type(s) that are accepted by the client stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyMultipartFormData +# RequestBody.Schemas.multipart_form_data ## Model Type Info Input Type | Accessed Type | Description | Notes @@ -3365,16 +3317,16 @@ Key | Input Type | Accessed Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#upload_file.ApiResponseFor200) | successful operation +200 | [response_for_200.ApiResponse](#upload_file.response_for_200.ApiResponse) | successful operation -#### upload_file.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#upload_file.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**ApiResponse**](../../models/ApiResponse.md) | | @@ -3388,7 +3340,6 @@ No authorization required # **upload_files** -> ApiResponse upload_files() uploads files using multipart/form-data @@ -3397,7 +3348,6 @@ uploads files using multipart/form-data ```python import petstore_api from petstore_api.apis.tags import fake_api -from petstore_api.model.api_response import ApiResponse 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. @@ -3429,16 +3379,16 @@ with petstore_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyMultipartFormData, Unset] | optional, default is unset | +[body](#upload_files.RequestBody) | typing.Union[[RequestBody.Schemas.multipart_form_data](#upload_files.RequestBody.Schemas.multipart_form_data), Unset] | optional, default is unset | content_type | str | optional, default is 'multipart/form-data' | Selects the schema and serialization of the request body accept_content_types | typing.Tuple[str] | default is ('application/json', ) | Tells the server the content type(s) that are accepted by the client stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyMultipartFormData +# RequestBody.Schemas.multipart_form_data ## Model Type Info Input Type | Accessed Type | Description | Notes @@ -3468,16 +3418,16 @@ items | bytes, io.FileIO, io.BufferedReader, | bytes, FileIO, | | Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#upload_files.ApiResponseFor200) | successful operation +200 | [response_for_200.ApiResponse](#upload_files.response_for_200.ApiResponse) | successful operation -#### upload_files.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#upload_files.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**ApiResponse**](../../models/ApiResponse.md) | | diff --git a/samples/openapi3/client/petstore/python/docs/apis/tags/FakeClassnameTags123Api.md b/samples/openapi3/client/petstore/python/docs/apis/tags/FakeClassnameTags123Api.md index 87b99456ada..8a5209ae4db 100644 --- a/samples/openapi3/client/petstore/python/docs/apis/tags/FakeClassnameTags123Api.md +++ b/samples/openapi3/client/petstore/python/docs/apis/tags/FakeClassnameTags123Api.md @@ -9,7 +9,6 @@ Method | HTTP request | Description # **classname** -> Client classname(client) To test class name in snake case @@ -61,16 +60,16 @@ with petstore_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#classname.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#classname.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body accept_content_types | typing.Tuple[str] | default is ('application/json', ) | Tells the server the content type(s) that are accepted by the client stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**Client**](../../models/Client.md) | | @@ -81,16 +80,16 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#classname.ApiResponseFor200) | successful operation +200 | [response_for_200.ApiResponse](#classname.response_for_200.ApiResponse) | successful operation -#### classname.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#classname.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**Client**](../../models/Client.md) | | diff --git a/samples/openapi3/client/petstore/python/docs/apis/tags/PetApi.md b/samples/openapi3/client/petstore/python/docs/apis/tags/PetApi.md index a295a0d499b..99c7f45ca94 100644 --- a/samples/openapi3/client/petstore/python/docs/apis/tags/PetApi.md +++ b/samples/openapi3/client/petstore/python/docs/apis/tags/PetApi.md @@ -17,7 +17,6 @@ Method | HTTP request | Description # **add_pet** -> add_pet(pet) Add a new pet to the store @@ -143,22 +142,22 @@ with petstore_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson, SchemaForRequestBodyApplicationXml] | required | +[body](#add_pet.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#add_pet.RequestBody.Schemas.application_json), [RequestBody.Schemas.application_xml](#add_pet.RequestBody.Schemas.application_xml)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body host_index | typing.Optional[int] | default is None | Allows one to select a different host stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**Pet**](../../models/Pet.md) | | -# SchemaForRequestBodyApplicationXml +# RequestBody.Schemas.application_xml Type | Description | Notes ------------- | ------------- | ------------- [**Pet**](../../models/Pet.md) | | @@ -169,17 +168,17 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#add_pet.ApiResponseFor200) | Ok -405 | [ApiResponseFor405](#add_pet.ApiResponseFor405) | Invalid input +200 | [response_for_200.ApiResponse](#add_pet.response_for_200.ApiResponse) | Ok +405 | [response_for_405.ApiResponse](#add_pet.response_for_405.ApiResponse) | Invalid input -#### add_pet.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | body | Unset | body was not defined | headers | Unset | headers were not defined | -#### add_pet.ApiResponseFor405 +#### response_for_405.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -194,7 +193,6 @@ headers | Unset | headers were not defined | # **delete_pet** -> delete_pet(pet_id) Deletes a pet @@ -261,34 +259,34 @@ with petstore_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -header_params | RequestHeaderParams | | -path_params | RequestPathParams | | +[header_params](#delete_pet.RequestHeaderParameters) | [RequestHeaderParameters.Params](#delete_pet.RequestHeaderParameters.Params) | | +[path_params](#delete_pet.RequestPathParameters) | [RequestPathParameters.Params](#delete_pet.RequestPathParameters.Params) | | stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### header_params -#### RequestHeaderParams +### header_params +#### RequestHeaderParameters.Params -Name | Type | Description | Notes +Key | Input Type | Description | Notes ------------- | ------------- | ------------- | ------------- -api_key | ApiKeySchema | | optional +api_key | [RequestHeaderParameters.Schemas.api_key](#delete_pet.RequestHeaderParameters.Schemas.api_key) | | optional -# ApiKeySchema +# RequestHeaderParameters.Schemas.api_key ## Model Type Info Input Type | Accessed Type | Description | Notes ------------ | ------------- | ------------- | ------------- str, | str, | | -### path_params -#### RequestPathParams +### path_params +#### RequestPathParameters.Params -Name | Type | Description | Notes +Key | Input Type | Description | Notes ------------- | ------------- | ------------- | ------------- -petId | PetIdSchema | | +petId | [RequestPathParameters.Schemas.petId](#delete_pet.RequestPathParameters.Schemas.petId) | | -# PetIdSchema +# RequestPathParameters.Schemas.petId ## Model Type Info Input Type | Accessed Type | Description | Notes @@ -300,9 +298,9 @@ decimal.Decimal, int, | decimal.Decimal, | | value must be a 64 bit integer Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -400 | [ApiResponseFor400](#delete_pet.ApiResponseFor400) | Invalid pet value +400 | [response_for_400.ApiResponse](#delete_pet.response_for_400.ApiResponse) | Invalid pet value -#### delete_pet.ApiResponseFor400 +#### response_for_400.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -317,7 +315,6 @@ headers | Unset | headers were not defined | # **find_pets_by_status** -> [Pet] find_pets_by_status(status) Finds Pets by status @@ -329,7 +326,6 @@ Multiple status values can be provided with comma separated strings ```python import petstore_api from petstore_api.apis.tags import pet_api -from petstore_api.model.pet import Pet 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. @@ -431,21 +427,21 @@ with petstore_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -query_params | RequestQueryParams | | +[query_params](#find_pets_by_status.RequestQueryParameters) | [RequestQueryParameters.Params](#find_pets_by_status.RequestQueryParameters.Params) | | accept_content_types | typing.Tuple[str] | default is ('application/xml', 'application/json', ) | Tells the server the content type(s) that are accepted by the client stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### query_params -#### RequestQueryParams +### query_params +#### RequestQueryParameters.Params -Name | Type | Description | Notes +Key | Input Type | Description | Notes ------------- | ------------- | ------------- | ------------- -status | StatusSchema | | +status | [RequestQueryParameters.Schemas.status](#find_pets_by_status.RequestQueryParameters.Schemas.status) | | -# StatusSchema +# RequestQueryParameters.Schemas.status ## Model Type Info Input Type | Accessed Type | Description | Notes @@ -462,17 +458,17 @@ items | str, | str, | | must be one of ["available", "pending", "sold", ] if Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#find_pets_by_status.ApiResponseFor200) | successful operation -400 | [ApiResponseFor400](#find_pets_by_status.ApiResponseFor400) | Invalid status value +200 | [response_for_200.ApiResponse](#find_pets_by_status.response_for_200.ApiResponse) | successful operation +400 | [response_for_400.ApiResponse](#find_pets_by_status.response_for_400.ApiResponse) | Invalid status value -#### find_pets_by_status.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationXml, SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_xml](#find_pets_by_status.response_for_200.BodySchemas.application_xml), [response_for_200.BodySchemas.application_json](#find_pets_by_status.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationXml +# response_for_200.BodySchemas.application_xml ## Model Type Info Input Type | Accessed Type | Description | Notes @@ -484,7 +480,7 @@ Class Name | Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- | ------------- [**Pet**]({{complexTypePrefix}}Pet.md) | [**Pet**]({{complexTypePrefix}}Pet.md) | [**Pet**]({{complexTypePrefix}}Pet.md) | | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json ## Model Type Info Input Type | Accessed Type | Description | Notes @@ -496,7 +492,7 @@ Class Name | Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- | ------------- [**Pet**]({{complexTypePrefix}}Pet.md) | [**Pet**]({{complexTypePrefix}}Pet.md) | [**Pet**]({{complexTypePrefix}}Pet.md) | | -#### find_pets_by_status.ApiResponseFor400 +#### response_for_400.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -511,7 +507,6 @@ headers | Unset | headers were not defined | # **find_pets_by_tags** -> [Pet] find_pets_by_tags(tags) Finds Pets by tags @@ -523,7 +518,6 @@ Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 ```python import petstore_api from petstore_api.apis.tags import pet_api -from petstore_api.model.pet import Pet 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. @@ -625,21 +619,21 @@ with petstore_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -query_params | RequestQueryParams | | +[query_params](#find_pets_by_tags.RequestQueryParameters) | [RequestQueryParameters.Params](#find_pets_by_tags.RequestQueryParameters.Params) | | accept_content_types | typing.Tuple[str] | default is ('application/xml', 'application/json', ) | Tells the server the content type(s) that are accepted by the client stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### query_params -#### RequestQueryParams +### query_params +#### RequestQueryParameters.Params -Name | Type | Description | Notes +Key | Input Type | Description | Notes ------------- | ------------- | ------------- | ------------- -tags | TagsSchema | | +tags | [RequestQueryParameters.Schemas.tags](#find_pets_by_tags.RequestQueryParameters.Schemas.tags) | | -# TagsSchema +# RequestQueryParameters.Schemas.tags ## Model Type Info Input Type | Accessed Type | Description | Notes @@ -656,17 +650,17 @@ items | str, | str, | | Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#find_pets_by_tags.ApiResponseFor200) | successful operation -400 | [ApiResponseFor400](#find_pets_by_tags.ApiResponseFor400) | Invalid tag value +200 | [response_for_200.ApiResponse](#find_pets_by_tags.response_for_200.ApiResponse) | successful operation +400 | [response_for_400.ApiResponse](#find_pets_by_tags.response_for_400.ApiResponse) | Invalid tag value -#### find_pets_by_tags.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationXml, SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_xml](#find_pets_by_tags.response_for_200.BodySchemas.application_xml), [response_for_200.BodySchemas.application_json](#find_pets_by_tags.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationXml +# response_for_200.BodySchemas.application_xml ## Model Type Info Input Type | Accessed Type | Description | Notes @@ -678,7 +672,7 @@ Class Name | Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- | ------------- [**Pet**]({{complexTypePrefix}}Pet.md) | [**Pet**]({{complexTypePrefix}}Pet.md) | [**Pet**]({{complexTypePrefix}}Pet.md) | | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json ## Model Type Info Input Type | Accessed Type | Description | Notes @@ -690,7 +684,7 @@ Class Name | Input Type | Accessed Type | Description | Notes ------------- | ------------- | ------------- | ------------- | ------------- [**Pet**]({{complexTypePrefix}}Pet.md) | [**Pet**]({{complexTypePrefix}}Pet.md) | [**Pet**]({{complexTypePrefix}}Pet.md) | | -#### find_pets_by_tags.ApiResponseFor400 +#### response_for_400.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -705,7 +699,6 @@ headers | Unset | headers were not defined | # **get_pet_by_id** -> Pet get_pet_by_id(pet_id) Find pet by ID @@ -717,7 +710,6 @@ Returns a single pet ```python import petstore_api from petstore_api.apis.tags import pet_api -from petstore_api.model.pet import Pet 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. @@ -757,20 +749,20 @@ with petstore_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -path_params | RequestPathParams | | +[path_params](#get_pet_by_id.RequestPathParameters) | [RequestPathParameters.Params](#get_pet_by_id.RequestPathParameters.Params) | | accept_content_types | typing.Tuple[str] | default is ('application/xml', 'application/json', ) | Tells the server the content type(s) that are accepted by the client stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### path_params -#### RequestPathParams +### path_params +#### RequestPathParameters.Params -Name | Type | Description | Notes +Key | Input Type | Description | Notes ------------- | ------------- | ------------- | ------------- -petId | PetIdSchema | | +petId | [RequestPathParameters.Schemas.petId](#get_pet_by_id.RequestPathParameters.Schemas.petId) | | -# PetIdSchema +# RequestPathParameters.Schemas.petId ## Model Type Info Input Type | Accessed Type | Description | Notes @@ -782,37 +774,37 @@ decimal.Decimal, int, | decimal.Decimal, | | value must be a 64 bit integer Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#get_pet_by_id.ApiResponseFor200) | successful operation -400 | [ApiResponseFor400](#get_pet_by_id.ApiResponseFor400) | Invalid ID supplied -404 | [ApiResponseFor404](#get_pet_by_id.ApiResponseFor404) | Pet not found +200 | [response_for_200.ApiResponse](#get_pet_by_id.response_for_200.ApiResponse) | successful operation +400 | [response_for_400.ApiResponse](#get_pet_by_id.response_for_400.ApiResponse) | Invalid ID supplied +404 | [response_for_404.ApiResponse](#get_pet_by_id.response_for_404.ApiResponse) | Pet not found -#### get_pet_by_id.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationXml, SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_xml](#get_pet_by_id.response_for_200.BodySchemas.application_xml), [response_for_200.BodySchemas.application_json](#get_pet_by_id.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationXml +# response_for_200.BodySchemas.application_xml Type | Description | Notes ------------- | ------------- | ------------- [**Pet**](../../models/Pet.md) | | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**Pet**](../../models/Pet.md) | | -#### get_pet_by_id.ApiResponseFor400 +#### response_for_400.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | body | Unset | body was not defined | headers | Unset | headers were not defined | -#### get_pet_by_id.ApiResponseFor404 +#### response_for_404.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -827,7 +819,6 @@ headers | Unset | headers were not defined | # **update_pet** -> update_pet(pet) Update an existing pet @@ -951,22 +942,22 @@ with petstore_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson, SchemaForRequestBodyApplicationXml] | required | +[body](#update_pet.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#update_pet.RequestBody.Schemas.application_json), [RequestBody.Schemas.application_xml](#update_pet.RequestBody.Schemas.application_xml)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body host_index | typing.Optional[int] | default is None | Allows one to select a different host stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**Pet**](../../models/Pet.md) | | -# SchemaForRequestBodyApplicationXml +# RequestBody.Schemas.application_xml Type | Description | Notes ------------- | ------------- | ------------- [**Pet**](../../models/Pet.md) | | @@ -977,25 +968,25 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -400 | [ApiResponseFor400](#update_pet.ApiResponseFor400) | Invalid ID supplied -404 | [ApiResponseFor404](#update_pet.ApiResponseFor404) | Pet not found -405 | [ApiResponseFor405](#update_pet.ApiResponseFor405) | Validation exception +400 | [response_for_400.ApiResponse](#update_pet.response_for_400.ApiResponse) | Invalid ID supplied +404 | [response_for_404.ApiResponse](#update_pet.response_for_404.ApiResponse) | Pet not found +405 | [response_for_405.ApiResponse](#update_pet.response_for_405.ApiResponse) | Validation exception -#### update_pet.ApiResponseFor400 +#### response_for_400.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | body | Unset | body was not defined | headers | Unset | headers were not defined | -#### update_pet.ApiResponseFor404 +#### response_for_404.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | body | Unset | body was not defined | headers | Unset | headers were not defined | -#### update_pet.ApiResponseFor405 +#### response_for_405.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -1010,7 +1001,6 @@ headers | Unset | headers were not defined | # **update_pet_with_form** -> update_pet_with_form(pet_id) Updates a pet in the store with form data @@ -1075,16 +1065,16 @@ with petstore_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, Unset] | optional, default is unset | -path_params | RequestPathParams | | +[body](#update_pet_with_form.RequestBody) | typing.Union[[RequestBody.Schemas.application_x_www_form_urlencoded](#update_pet_with_form.RequestBody.Schemas.application_x_www_form_urlencoded), Unset] | optional, default is unset | +[path_params](#update_pet_with_form.RequestPathParameters) | [RequestPathParameters.Params](#update_pet_with_form.RequestPathParameters.Params) | | content_type | str | optional, default is 'application/x-www-form-urlencoded' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationXWwwFormUrlencoded +# RequestBody.Schemas.application_x_www_form_urlencoded ## Model Type Info Input Type | Accessed Type | Description | Notes @@ -1098,14 +1088,14 @@ Key | Input Type | Accessed Type | Description | Notes **status** | str, | str, | Updated status of the pet | [optional] **any_string_name** | dict, frozendict.frozendict, str, date, datetime, int, float, bool, decimal.Decimal, None, list, tuple, bytes, io.FileIO, io.BufferedReader | frozendict.frozendict, str, BoolClass, decimal.Decimal, NoneClass, tuple, bytes, FileIO | any string name can be used but the value must be the correct type | [optional] -### path_params -#### RequestPathParams +### path_params +#### RequestPathParameters.Params -Name | Type | Description | Notes +Key | Input Type | Description | Notes ------------- | ------------- | ------------- | ------------- -petId | PetIdSchema | | +petId | [RequestPathParameters.Schemas.petId](#update_pet_with_form.RequestPathParameters.Schemas.petId) | | -# PetIdSchema +# RequestPathParameters.Schemas.petId ## Model Type Info Input Type | Accessed Type | Description | Notes @@ -1117,9 +1107,9 @@ decimal.Decimal, int, | decimal.Decimal, | | value must be a 64 bit integer Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -405 | [ApiResponseFor405](#update_pet_with_form.ApiResponseFor405) | Invalid input +405 | [response_for_405.ApiResponse](#update_pet_with_form.response_for_405.ApiResponse) | Invalid input -#### update_pet_with_form.ApiResponseFor405 +#### response_for_405.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -1134,7 +1124,6 @@ headers | Unset | headers were not defined | # **upload_file_with_required_file** -> ApiResponse upload_file_with_required_file(pet_id) uploads an image (required) @@ -1144,7 +1133,6 @@ uploads an image (required) ```python import petstore_api from petstore_api.apis.tags import pet_api -from petstore_api.model.api_response import ApiResponse 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. @@ -1202,17 +1190,17 @@ with petstore_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyMultipartFormData, Unset] | optional, default is unset | -path_params | RequestPathParams | | +[body](#upload_file_with_required_file.RequestBody) | typing.Union[[RequestBody.Schemas.multipart_form_data](#upload_file_with_required_file.RequestBody.Schemas.multipart_form_data), Unset] | optional, default is unset | +[path_params](#upload_file_with_required_file.RequestPathParameters) | [RequestPathParameters.Params](#upload_file_with_required_file.RequestPathParameters.Params) | | content_type | str | optional, default is 'multipart/form-data' | Selects the schema and serialization of the request body accept_content_types | typing.Tuple[str] | default is ('application/json', ) | Tells the server the content type(s) that are accepted by the client stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyMultipartFormData +# RequestBody.Schemas.multipart_form_data ## Model Type Info Input Type | Accessed Type | Description | Notes @@ -1226,14 +1214,14 @@ Key | Input Type | Accessed Type | Description | Notes **additionalMetadata** | str, | str, | Additional data to pass to server | [optional] **any_string_name** | dict, frozendict.frozendict, str, date, datetime, int, float, bool, decimal.Decimal, None, list, tuple, bytes, io.FileIO, io.BufferedReader | frozendict.frozendict, str, BoolClass, decimal.Decimal, NoneClass, tuple, bytes, FileIO | any string name can be used but the value must be the correct type | [optional] -### path_params -#### RequestPathParams +### path_params +#### RequestPathParameters.Params -Name | Type | Description | Notes +Key | Input Type | Description | Notes ------------- | ------------- | ------------- | ------------- -petId | PetIdSchema | | +petId | [RequestPathParameters.Schemas.petId](#upload_file_with_required_file.RequestPathParameters.Schemas.petId) | | -# PetIdSchema +# RequestPathParameters.Schemas.petId ## Model Type Info Input Type | Accessed Type | Description | Notes @@ -1245,16 +1233,16 @@ decimal.Decimal, int, | decimal.Decimal, | | value must be a 64 bit integer Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#upload_file_with_required_file.ApiResponseFor200) | successful operation +200 | [response_for_200.ApiResponse](#upload_file_with_required_file.response_for_200.ApiResponse) | successful operation -#### upload_file_with_required_file.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#upload_file_with_required_file.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**ApiResponse**](../../models/ApiResponse.md) | | @@ -1268,7 +1256,6 @@ Type | Description | Notes # **upload_image** -> ApiResponse upload_image(pet_id) uploads an image @@ -1278,7 +1265,6 @@ uploads an image ```python import petstore_api from petstore_api.apis.tags import pet_api -from petstore_api.model.api_response import ApiResponse 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. @@ -1336,17 +1322,17 @@ with petstore_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyMultipartFormData, Unset] | optional, default is unset | -path_params | RequestPathParams | | +[body](#upload_image.RequestBody) | typing.Union[[RequestBody.Schemas.multipart_form_data](#upload_image.RequestBody.Schemas.multipart_form_data), Unset] | optional, default is unset | +[path_params](#upload_image.RequestPathParameters) | [RequestPathParameters.Params](#upload_image.RequestPathParameters.Params) | | content_type | str | optional, default is 'multipart/form-data' | Selects the schema and serialization of the request body accept_content_types | typing.Tuple[str] | default is ('application/json', ) | Tells the server the content type(s) that are accepted by the client stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyMultipartFormData +# RequestBody.Schemas.multipart_form_data ## Model Type Info Input Type | Accessed Type | Description | Notes @@ -1360,14 +1346,14 @@ Key | Input Type | Accessed Type | Description | Notes **file** | bytes, io.FileIO, io.BufferedReader, | bytes, FileIO, | file to upload | [optional] **any_string_name** | dict, frozendict.frozendict, str, date, datetime, int, float, bool, decimal.Decimal, None, list, tuple, bytes, io.FileIO, io.BufferedReader | frozendict.frozendict, str, BoolClass, decimal.Decimal, NoneClass, tuple, bytes, FileIO | any string name can be used but the value must be the correct type | [optional] -### path_params -#### RequestPathParams +### path_params +#### RequestPathParameters.Params -Name | Type | Description | Notes +Key | Input Type | Description | Notes ------------- | ------------- | ------------- | ------------- -petId | PetIdSchema | | +petId | [RequestPathParameters.Schemas.petId](#upload_image.RequestPathParameters.Schemas.petId) | | -# PetIdSchema +# RequestPathParameters.Schemas.petId ## Model Type Info Input Type | Accessed Type | Description | Notes @@ -1379,16 +1365,16 @@ decimal.Decimal, int, | decimal.Decimal, | | value must be a 64 bit integer Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#upload_image.ApiResponseFor200) | successful operation +200 | [response_for_200.ApiResponse](#upload_image.response_for_200.ApiResponse) | successful operation -#### upload_image.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#upload_image.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**ApiResponse**](../../models/ApiResponse.md) | | diff --git a/samples/openapi3/client/petstore/python/docs/apis/tags/StoreApi.md b/samples/openapi3/client/petstore/python/docs/apis/tags/StoreApi.md index a75abbcffc0..c8fca2b4465 100644 --- a/samples/openapi3/client/petstore/python/docs/apis/tags/StoreApi.md +++ b/samples/openapi3/client/petstore/python/docs/apis/tags/StoreApi.md @@ -12,7 +12,6 @@ Method | HTTP request | Description # **delete_order** -> delete_order(order_id) Delete purchase order by ID @@ -51,19 +50,19 @@ with petstore_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -path_params | RequestPathParams | | +[path_params](#delete_order.RequestPathParameters) | [RequestPathParameters.Params](#delete_order.RequestPathParameters.Params) | | stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### path_params -#### RequestPathParams +### path_params +#### RequestPathParameters.Params -Name | Type | Description | Notes +Key | Input Type | Description | Notes ------------- | ------------- | ------------- | ------------- -order_id | OrderIdSchema | | +order_id | [RequestPathParameters.Schemas.order_id](#delete_order.RequestPathParameters.Schemas.order_id) | | -# OrderIdSchema +# RequestPathParameters.Schemas.order_id ## Model Type Info Input Type | Accessed Type | Description | Notes @@ -75,17 +74,17 @@ str, | str, | | Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -400 | [ApiResponseFor400](#delete_order.ApiResponseFor400) | Invalid ID supplied -404 | [ApiResponseFor404](#delete_order.ApiResponseFor404) | Order not found +400 | [response_for_400.ApiResponse](#delete_order.response_for_400.ApiResponse) | Invalid ID supplied +404 | [response_for_404.ApiResponse](#delete_order.response_for_404.ApiResponse) | Order not found -#### delete_order.ApiResponseFor400 +#### response_for_400.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | body | Unset | body was not defined | headers | Unset | headers were not defined | -#### delete_order.ApiResponseFor404 +#### response_for_404.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -100,7 +99,6 @@ No authorization required # **get_inventory** -> {str: (int,)} get_inventory() Returns pet inventories by status @@ -150,16 +148,16 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#get_inventory.ApiResponseFor200) | successful operation +200 | [response_for_200.ApiResponse](#get_inventory.response_for_200.ApiResponse) | successful operation -#### get_inventory.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_json](#get_inventory.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json ## Model Type Info Input Type | Accessed Type | Description | Notes @@ -179,7 +177,6 @@ Key | Input Type | Accessed Type | Description | Notes # **get_order_by_id** -> Order get_order_by_id(order_id) Find purchase order by ID @@ -190,7 +187,6 @@ For valid response try integer IDs with value <= 5 or > 10. Other values will ge ```python import petstore_api from petstore_api.apis.tags import store_api -from petstore_api.model.order import Order 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. @@ -220,20 +216,20 @@ with petstore_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -path_params | RequestPathParams | | +[path_params](#get_order_by_id.RequestPathParameters) | [RequestPathParameters.Params](#get_order_by_id.RequestPathParameters.Params) | | accept_content_types | typing.Tuple[str] | default is ('application/xml', 'application/json', ) | Tells the server the content type(s) that are accepted by the client stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### path_params -#### RequestPathParams +### path_params +#### RequestPathParameters.Params -Name | Type | Description | Notes +Key | Input Type | Description | Notes ------------- | ------------- | ------------- | ------------- -order_id | OrderIdSchema | | +order_id | [RequestPathParameters.Schemas.order_id](#get_order_by_id.RequestPathParameters.Schemas.order_id) | | -# OrderIdSchema +# RequestPathParameters.Schemas.order_id ## Model Type Info Input Type | Accessed Type | Description | Notes @@ -245,37 +241,37 @@ decimal.Decimal, int, | decimal.Decimal, | | value must be a 64 bit integer Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#get_order_by_id.ApiResponseFor200) | successful operation -400 | [ApiResponseFor400](#get_order_by_id.ApiResponseFor400) | Invalid ID supplied -404 | [ApiResponseFor404](#get_order_by_id.ApiResponseFor404) | Order not found +200 | [response_for_200.ApiResponse](#get_order_by_id.response_for_200.ApiResponse) | successful operation +400 | [response_for_400.ApiResponse](#get_order_by_id.response_for_400.ApiResponse) | Invalid ID supplied +404 | [response_for_404.ApiResponse](#get_order_by_id.response_for_404.ApiResponse) | Order not found -#### get_order_by_id.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationXml, SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_xml](#get_order_by_id.response_for_200.BodySchemas.application_xml), [response_for_200.BodySchemas.application_json](#get_order_by_id.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationXml +# response_for_200.BodySchemas.application_xml Type | Description | Notes ------------- | ------------- | ------------- [**Order**](../../models/Order.md) | | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**Order**](../../models/Order.md) | | -#### get_order_by_id.ApiResponseFor400 +#### response_for_400.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | body | Unset | body was not defined | headers | Unset | headers were not defined | -#### get_order_by_id.ApiResponseFor404 +#### response_for_404.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -290,7 +286,6 @@ No authorization required # **place_order** -> Order place_order(order) Place an order for a pet @@ -334,16 +329,16 @@ with petstore_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#place_order.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#place_order.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body accept_content_types | typing.Tuple[str] | default is ('application/xml', 'application/json', ) | Tells the server the content type(s) that are accepted by the client stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**Order**](../../models/Order.md) | | @@ -354,29 +349,29 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#place_order.ApiResponseFor200) | successful operation -400 | [ApiResponseFor400](#place_order.ApiResponseFor400) | Invalid Order +200 | [response_for_200.ApiResponse](#place_order.response_for_200.ApiResponse) | successful operation +400 | [response_for_400.ApiResponse](#place_order.response_for_400.ApiResponse) | Invalid Order -#### place_order.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationXml, SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_xml](#place_order.response_for_200.BodySchemas.application_xml), [response_for_200.BodySchemas.application_json](#place_order.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationXml +# response_for_200.BodySchemas.application_xml Type | Description | Notes ------------- | ------------- | ------------- [**Order**](../../models/Order.md) | | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**Order**](../../models/Order.md) | | -#### place_order.ApiResponseFor400 +#### response_for_400.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | diff --git a/samples/openapi3/client/petstore/python/docs/apis/tags/UserApi.md b/samples/openapi3/client/petstore/python/docs/apis/tags/UserApi.md index 6b0fd83c5db..8dad09635c9 100644 --- a/samples/openapi3/client/petstore/python/docs/apis/tags/UserApi.md +++ b/samples/openapi3/client/petstore/python/docs/apis/tags/UserApi.md @@ -16,7 +16,6 @@ Method | HTTP request | Description # **create_user** -> create_user(user) Create user @@ -68,15 +67,15 @@ with petstore_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#create_user.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#create_user.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**User**](../../models/User.md) | | @@ -87,9 +86,9 @@ Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -default | [ApiResponseForDefault](#create_user.ApiResponseForDefault) | successful operation +default | [response_for_default.ApiResponse](#create_user.response_for_default.ApiResponse) | successful operation -#### create_user.ApiResponseForDefault +#### response_for_default.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -104,7 +103,6 @@ No authorization required # **create_users_with_array_input** -> create_users_with_array_input(user) Creates list of users with given input array @@ -156,15 +154,15 @@ with petstore_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#create_users_with_array_input.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#create_users_with_array_input.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json ## Model Type Info Input Type | Accessed Type | Description | Notes @@ -181,9 +179,9 @@ Class Name | Input Type | Accessed Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -default | [ApiResponseForDefault](#create_users_with_array_input.ApiResponseForDefault) | successful operation +default | [response_for_default.ApiResponse](#create_users_with_array_input.response_for_default.ApiResponse) | successful operation -#### create_users_with_array_input.ApiResponseForDefault +#### response_for_default.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -198,7 +196,6 @@ No authorization required # **create_users_with_list_input** -> create_users_with_list_input(user) Creates list of users with given input array @@ -250,15 +247,15 @@ with petstore_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | +[body](#create_users_with_list_input.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#create_users_with_list_input.RequestBody.Schemas.application_json)] | required | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json ## Model Type Info Input Type | Accessed Type | Description | Notes @@ -275,9 +272,9 @@ Class Name | Input Type | Accessed Type | Description | Notes Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -default | [ApiResponseForDefault](#create_users_with_list_input.ApiResponseForDefault) | successful operation +default | [response_for_default.ApiResponse](#create_users_with_list_input.response_for_default.ApiResponse) | successful operation -#### create_users_with_list_input.ApiResponseForDefault +#### response_for_default.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -292,7 +289,6 @@ No authorization required # **delete_user** -> delete_user(username) Delete user @@ -331,19 +327,19 @@ with petstore_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -path_params | RequestPathParams | | +[path_params](#delete_user.RequestPathParameters) | [RequestPathParameters.Params](#delete_user.RequestPathParameters.Params) | | stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### path_params -#### RequestPathParams +### path_params +#### RequestPathParameters.Params -Name | Type | Description | Notes +Key | Input Type | Description | Notes ------------- | ------------- | ------------- | ------------- -username | UsernameSchema | | +username | [RequestPathParameters.Schemas.username](#delete_user.RequestPathParameters.Schemas.username) | | -# UsernameSchema +# RequestPathParameters.Schemas.username ## Model Type Info Input Type | Accessed Type | Description | Notes @@ -355,17 +351,17 @@ str, | str, | | Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#delete_user.ApiResponseFor200) | Success -404 | [ApiResponseFor404](#delete_user.ApiResponseFor404) | User not found +200 | [response_for_200.ApiResponse](#delete_user.response_for_200.ApiResponse) | Success +404 | [response_for_404.ApiResponse](#delete_user.response_for_404.ApiResponse) | User not found -#### delete_user.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | body | Unset | body was not defined | headers | Unset | headers were not defined | -#### delete_user.ApiResponseFor404 +#### response_for_404.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -380,7 +376,6 @@ No authorization required # **get_user_by_name** -> User get_user_by_name(username) Get user by user name @@ -389,7 +384,6 @@ Get user by user name ```python import petstore_api from petstore_api.apis.tags import user_api -from petstore_api.model.user import User 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. @@ -419,20 +413,20 @@ with petstore_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -path_params | RequestPathParams | | +[path_params](#get_user_by_name.RequestPathParameters) | [RequestPathParameters.Params](#get_user_by_name.RequestPathParameters.Params) | | accept_content_types | typing.Tuple[str] | default is ('application/xml', 'application/json', ) | Tells the server the content type(s) that are accepted by the client stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### path_params -#### RequestPathParams +### path_params +#### RequestPathParameters.Params -Name | Type | Description | Notes +Key | Input Type | Description | Notes ------------- | ------------- | ------------- | ------------- -username | UsernameSchema | | +username | [RequestPathParameters.Schemas.username](#get_user_by_name.RequestPathParameters.Schemas.username) | | -# UsernameSchema +# RequestPathParameters.Schemas.username ## Model Type Info Input Type | Accessed Type | Description | Notes @@ -444,37 +438,37 @@ str, | str, | | Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#get_user_by_name.ApiResponseFor200) | successful operation -400 | [ApiResponseFor400](#get_user_by_name.ApiResponseFor400) | Invalid username supplied -404 | [ApiResponseFor404](#get_user_by_name.ApiResponseFor404) | User not found +200 | [response_for_200.ApiResponse](#get_user_by_name.response_for_200.ApiResponse) | successful operation +400 | [response_for_400.ApiResponse](#get_user_by_name.response_for_400.ApiResponse) | Invalid username supplied +404 | [response_for_404.ApiResponse](#get_user_by_name.response_for_404.ApiResponse) | User not found -#### get_user_by_name.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationXml, SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_xml](#get_user_by_name.response_for_200.BodySchemas.application_xml), [response_for_200.BodySchemas.application_json](#get_user_by_name.response_for_200.BodySchemas.application_json), ] | | headers | Unset | headers were not defined | -# SchemaFor200ResponseBodyApplicationXml +# response_for_200.BodySchemas.application_xml Type | Description | Notes ------------- | ------------- | ------------- [**User**](../../models/User.md) | | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**User**](../../models/User.md) | | -#### get_user_by_name.ApiResponseFor400 +#### response_for_400.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | body | Unset | body was not defined | headers | Unset | headers were not defined | -#### get_user_by_name.ApiResponseFor404 +#### response_for_404.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -489,7 +483,6 @@ No authorization required # **login_user** -> str login_user(usernamepassword) Logs user into the system @@ -528,29 +521,29 @@ with petstore_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -query_params | RequestQueryParams | | +[query_params](#login_user.RequestQueryParameters) | [RequestQueryParameters.Params](#login_user.RequestQueryParameters.Params) | | accept_content_types | typing.Tuple[str] | default is ('application/xml', 'application/json', ) | Tells the server the content type(s) that are accepted by the client stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### query_params -#### RequestQueryParams +### query_params +#### RequestQueryParameters.Params -Name | Type | Description | Notes +Key | Input Type | Description | Notes ------------- | ------------- | ------------- | ------------- -username | UsernameSchema | | -password | PasswordSchema | | +username | [RequestQueryParameters.Schemas.username](#login_user.RequestQueryParameters.Schemas.username) | | +password | [RequestQueryParameters.Schemas.password](#login_user.RequestQueryParameters.Schemas.password) | | -# UsernameSchema +# RequestQueryParameters.Schemas.username ## Model Type Info Input Type | Accessed Type | Description | Notes ------------ | ------------- | ------------- | ------------- str, | str, | | -# PasswordSchema +# RequestQueryParameters.Schemas.password ## Model Type Info Input Type | Accessed Type | Description | Notes @@ -562,24 +555,24 @@ str, | str, | | Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -200 | [ApiResponseFor200](#login_user.ApiResponseFor200) | successful operation -400 | [ApiResponseFor400](#login_user.ApiResponseFor400) | Invalid username/password supplied +200 | [response_for_200.ApiResponse](#login_user.response_for_200.ApiResponse) | successful operation +400 | [response_for_400.ApiResponse](#login_user.response_for_400.ApiResponse) | Invalid username/password supplied -#### login_user.ApiResponseFor200 +#### response_for_200.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | -body | typing.Union[SchemaFor200ResponseBodyApplicationXml, SchemaFor200ResponseBodyApplicationJson, ] | | +body | typing.Union[[response_for_200.BodySchemas.application_xml](#login_user.response_for_200.BodySchemas.application_xml), [response_for_200.BodySchemas.application_json](#login_user.response_for_200.BodySchemas.application_json), ] | | headers | ResponseHeadersFor200 | | -# SchemaFor200ResponseBodyApplicationXml +# response_for_200.BodySchemas.application_xml ## Model Type Info Input Type | Accessed Type | Description | Notes ------------ | ------------- | ------------- | ------------- str, | str, | | -# SchemaFor200ResponseBodyApplicationJson +# response_for_200.BodySchemas.application_json ## Model Type Info Input Type | Accessed Type | Description | Notes @@ -589,10 +582,10 @@ str, | str, | | Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -X-Rate-Limit | XRateLimitSchema | | optional -X-Expires-After | XExpiresAfterSchema | | optional +X-Rate-Limit | X-Rate-Limit | | optional +X-Expires-After | X-Expires-After | | optional -# XRateLimitSchema +# X-Rate-Limit calls per hour allowed by the user @@ -601,7 +594,7 @@ Input Type | Accessed Type | Description | Notes ------------ | ------------- | ------------- | ------------- decimal.Decimal, int, | decimal.Decimal, | calls per hour allowed by the user | value must be a 32 bit integer -# XExpiresAfterSchema +# X-Expires-After date in UTC when token expires @@ -611,7 +604,7 @@ Input Type | Accessed Type | Description | Notes str, datetime, | str, | date in UTC when token expires | value must conform to RFC-3339 date-time -#### login_user.ApiResponseFor400 +#### response_for_400.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -626,7 +619,6 @@ No authorization required # **logout_user** -> logout_user() Logs out current logged in user session @@ -662,9 +654,9 @@ This endpoint does not need any parameter. Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -default | [ApiResponseForDefault](#logout_user.ApiResponseForDefault) | successful operation +default | [response_for_default.ApiResponse](#logout_user.response_for_default.ApiResponse) | successful operation -#### logout_user.ApiResponseForDefault +#### response_for_default.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | @@ -679,7 +671,6 @@ No authorization required # **update_user** -> update_user(usernameuser) Updated user @@ -735,29 +726,29 @@ with petstore_api.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -body | typing.Union[SchemaForRequestBodyApplicationJson] | required | -path_params | RequestPathParams | | +[body](#update_user.RequestBody) | typing.Union[[RequestBody.Schemas.application_json](#update_user.RequestBody.Schemas.application_json)] | required | +[path_params](#update_user.RequestPathParameters) | [RequestPathParameters.Params](#update_user.RequestPathParameters.Params) | | content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned -### body +### body -# SchemaForRequestBodyApplicationJson +# RequestBody.Schemas.application_json Type | Description | Notes ------------- | ------------- | ------------- [**User**](../../models/User.md) | | -### path_params -#### RequestPathParams +### path_params +#### RequestPathParameters.Params -Name | Type | Description | Notes +Key | Input Type | Description | Notes ------------- | ------------- | ------------- | ------------- -username | UsernameSchema | | +username | [RequestPathParameters.Schemas.username](#update_user.RequestPathParameters.Schemas.username) | | -# UsernameSchema +# RequestPathParameters.Schemas.username ## Model Type Info Input Type | Accessed Type | Description | Notes @@ -769,17 +760,17 @@ str, | str, | | Code | Class | Description ------------- | ------------- | ------------- n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned -400 | [ApiResponseFor400](#update_user.ApiResponseFor400) | Invalid user supplied -404 | [ApiResponseFor404](#update_user.ApiResponseFor404) | User not found +400 | [response_for_400.ApiResponse](#update_user.response_for_400.ApiResponse) | Invalid user supplied +404 | [response_for_404.ApiResponse](#update_user.response_for_404.ApiResponse) | User not found -#### update_user.ApiResponseFor400 +#### response_for_400.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | body | Unset | body was not defined | headers | Unset | headers were not defined | -#### update_user.ApiResponseFor404 +#### response_for_404.ApiResponse Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- response | urllib3.HTTPResponse | Raw response | diff --git a/samples/openapi3/client/petstore/python/docs/models/Foo.md b/samples/openapi3/client/petstore/python/docs/models/Foo.md index 5ea8d33d369..a7accdf8874 100644 --- a/samples/openapi3/client/petstore/python/docs/models/Foo.md +++ b/samples/openapi3/client/petstore/python/docs/models/Foo.md @@ -8,7 +8,7 @@ dict, frozendict.frozendict, | frozendict.frozendict, | | ### Dictionary Keys Key | Input Type | Accessed Type | Description | Notes ------------ | ------------- | ------------- | ------------- | ------------- -**bar** | str, | str, | | [optional] if omitted the server will use the default value of "bar" +**bar** | [**Bar**](Bar.md) | [**Bar**](Bar.md) | | [optional] **any_string_name** | dict, frozendict.frozendict, str, date, datetime, int, float, bool, decimal.Decimal, None, list, tuple, bytes, io.FileIO, io.BufferedReader | frozendict.frozendict, str, BoolClass, decimal.Decimal, NoneClass, tuple, bytes, FileIO | any string name can be used but the value must be the correct type | [optional] [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/samples/openapi3/client/petstore/python/docs/models/ObjectModelWithRefProps.md b/samples/openapi3/client/petstore/python/docs/models/ObjectModelWithRefProps.md index 8bb001aa771..6fe20b1c886 100644 --- a/samples/openapi3/client/petstore/python/docs/models/ObjectModelWithRefProps.md +++ b/samples/openapi3/client/petstore/python/docs/models/ObjectModelWithRefProps.md @@ -11,8 +11,8 @@ dict, frozendict.frozendict, | frozendict.frozendict, | a model that includes Key | Input Type | Accessed Type | Description | Notes ------------ | ------------- | ------------- | ------------- | ------------- **myNumber** | [**NumberWithValidations**](NumberWithValidations.md) | [**NumberWithValidations**](NumberWithValidations.md) | | [optional] -**myString** | str, | str, | | [optional] -**myBoolean** | bool, | BoolClass, | | [optional] +**myString** | [**String**](String.md) | [**String**](String.md) | | [optional] +**myBoolean** | [**Boolean**](Boolean.md) | [**Boolean**](Boolean.md) | | [optional] **any_string_name** | dict, frozendict.frozendict, str, date, datetime, int, float, bool, decimal.Decimal, None, list, tuple, bytes, io.FileIO, io.BufferedReader | frozendict.frozendict, str, BoolClass, decimal.Decimal, NoneClass, tuple, bytes, FileIO | any string name can be used but the value must be the correct type | [optional] [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/samples/openapi3/client/petstore/python/docs/models/ObjectWithDecimalProperties.md b/samples/openapi3/client/petstore/python/docs/models/ObjectWithDecimalProperties.md index 82c1abadd60..dc1e9cd6d53 100644 --- a/samples/openapi3/client/petstore/python/docs/models/ObjectWithDecimalProperties.md +++ b/samples/openapi3/client/petstore/python/docs/models/ObjectWithDecimalProperties.md @@ -8,7 +8,7 @@ dict, frozendict.frozendict, | frozendict.frozendict, | | ### Dictionary Keys Key | Input Type | Accessed Type | Description | Notes ------------ | ------------- | ------------- | ------------- | ------------- -**length** | str, | str, | | [optional] value must be numeric and storable in decimal.Decimal +**length** | [**DecimalPayload**](DecimalPayload.md) | [**DecimalPayload**](DecimalPayload.md) | | [optional] **width** | str, | str, | | [optional] value must be numeric and storable in decimal.Decimal **cost** | [**Money**](Money.md) | [**Money**](Money.md) | | [optional] **any_string_name** | dict, frozendict.frozendict, str, date, datetime, int, float, bool, decimal.Decimal, None, list, tuple, bytes, io.FileIO, io.BufferedReader | frozendict.frozendict, str, BoolClass, decimal.Decimal, NoneClass, tuple, bytes, FileIO | any string name can be used but the value must be the correct type | [optional] diff --git a/samples/openapi3/client/petstore/python/petstore_api/api_client.py b/samples/openapi3/client/petstore/python/petstore_api/api_client.py index 9ee9ff13f68..e822104d17e 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/api_client.py +++ b/samples/openapi3/client/petstore/python/petstore_api/api_client.py @@ -8,7 +8,7 @@ Generated by: https://openapi-generator.tech """ -from dataclasses import dataclass +import dataclasses from decimal import Decimal import enum import email @@ -343,7 +343,7 @@ def _content_type_is_json(cls, content_type: str) -> bool: return False -@dataclass +@dataclasses.dataclass class ParameterBase(JSONDetector): name: str in_type: ParameterInType @@ -783,7 +783,7 @@ def __init__( self.allow_reserved = allow_reserved -@dataclass +@dataclasses.dataclass class MediaType: """ Used to store request and response body schema information @@ -797,7 +797,7 @@ class MediaType: encoding: typing.Optional[typing.Dict[str, Encoding]] = None -@dataclass +@dataclasses.dataclass class ApiResponse: response: urllib3.HTTPResponse body: typing.Union[Unset, Schema] @@ -806,8 +806,8 @@ class ApiResponse: def __init__( self, response: urllib3.HTTPResponse, - body: typing.Union[Unset, typing.Type[Schema]], - headers: typing.Union[Unset, typing.List[HeaderParameter]] + body: typing.Union[Unset, typing.Type[Schema]] = unset, + headers: typing.Union[Unset, typing.List[HeaderParameter]] = unset ): """ pycharm needs this to prevent 'Unexpected argument' warnings @@ -817,7 +817,7 @@ def __init__( self.headers = headers -@dataclass +@dataclasses.dataclass class ApiResponseWithoutDeserialization(ApiResponse): response: urllib3.HTTPResponse body: typing.Union[Unset, typing.Type[Schema]] = unset diff --git a/samples/openapi3/client/petstore/python/petstore_api/model/foo.py b/samples/openapi3/client/petstore/python/petstore_api/model/foo.py index ce7d00afa0a..c8bc70e74ff 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/model/foo.py +++ b/samples/openapi3/client/petstore/python/petstore_api/model/foo.py @@ -36,13 +36,16 @@ class Foo( class MetaOapg: class properties: - bar = schemas.StrSchema + + @staticmethod + def bar() -> typing.Type['Bar']: + return Bar __annotations__ = { "bar": bar, } @typing.overload - def __getitem__(self, name: typing_extensions.Literal["bar"]) -> MetaOapg.properties.bar: ... + def __getitem__(self, name: typing_extensions.Literal["bar"]) -> 'Bar': ... @typing.overload def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... @@ -53,7 +56,7 @@ def __getitem__(self, name: typing.Union[typing_extensions.Literal["bar", ], str @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["bar"]) -> typing.Union[MetaOapg.properties.bar, schemas.Unset]: ... + def get_item_oapg(self, name: typing_extensions.Literal["bar"]) -> typing.Union['Bar', schemas.Unset]: ... @typing.overload def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... @@ -65,7 +68,7 @@ def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["bar", ], s def __new__( cls, *args: typing.Union[dict, frozendict.frozendict, ], - bar: typing.Union[MetaOapg.properties.bar, str, schemas.Unset] = schemas.unset, + bar: typing.Union['Bar', schemas.Unset] = schemas.unset, _configuration: typing.Optional[schemas.Configuration] = None, **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], ) -> 'Foo': @@ -76,3 +79,5 @@ def __new__( _configuration=_configuration, **kwargs, ) + +from petstore_api.model.bar import Bar diff --git a/samples/openapi3/client/petstore/python/petstore_api/model/foo.pyi b/samples/openapi3/client/petstore/python/petstore_api/model/foo.pyi index ce7d00afa0a..c8bc70e74ff 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/model/foo.pyi +++ b/samples/openapi3/client/petstore/python/petstore_api/model/foo.pyi @@ -36,13 +36,16 @@ class Foo( class MetaOapg: class properties: - bar = schemas.StrSchema + + @staticmethod + def bar() -> typing.Type['Bar']: + return Bar __annotations__ = { "bar": bar, } @typing.overload - def __getitem__(self, name: typing_extensions.Literal["bar"]) -> MetaOapg.properties.bar: ... + def __getitem__(self, name: typing_extensions.Literal["bar"]) -> 'Bar': ... @typing.overload def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... @@ -53,7 +56,7 @@ class Foo( @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["bar"]) -> typing.Union[MetaOapg.properties.bar, schemas.Unset]: ... + def get_item_oapg(self, name: typing_extensions.Literal["bar"]) -> typing.Union['Bar', schemas.Unset]: ... @typing.overload def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... @@ -65,7 +68,7 @@ class Foo( def __new__( cls, *args: typing.Union[dict, frozendict.frozendict, ], - bar: typing.Union[MetaOapg.properties.bar, str, schemas.Unset] = schemas.unset, + bar: typing.Union['Bar', schemas.Unset] = schemas.unset, _configuration: typing.Optional[schemas.Configuration] = None, **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], ) -> 'Foo': @@ -76,3 +79,5 @@ class Foo( _configuration=_configuration, **kwargs, ) + +from petstore_api.model.bar import Bar diff --git a/samples/openapi3/client/petstore/python/petstore_api/model/object_model_with_ref_props.py b/samples/openapi3/client/petstore/python/petstore_api/model/object_model_with_ref_props.py index e68caff8717..b3ab14ba2d5 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/model/object_model_with_ref_props.py +++ b/samples/openapi3/client/petstore/python/petstore_api/model/object_model_with_ref_props.py @@ -42,8 +42,14 @@ class properties: @staticmethod def myNumber() -> typing.Type['NumberWithValidations']: return NumberWithValidations - myString = schemas.StrSchema - myBoolean = schemas.BoolSchema + + @staticmethod + def myString() -> typing.Type['String']: + return String + + @staticmethod + def myBoolean() -> typing.Type['Boolean']: + return Boolean __annotations__ = { "myNumber": myNumber, "myString": myString, @@ -54,10 +60,10 @@ def myNumber() -> typing.Type['NumberWithValidations']: def __getitem__(self, name: typing_extensions.Literal["myNumber"]) -> 'NumberWithValidations': ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["myString"]) -> MetaOapg.properties.myString: ... + def __getitem__(self, name: typing_extensions.Literal["myString"]) -> 'String': ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["myBoolean"]) -> MetaOapg.properties.myBoolean: ... + def __getitem__(self, name: typing_extensions.Literal["myBoolean"]) -> 'Boolean': ... @typing.overload def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... @@ -71,10 +77,10 @@ def __getitem__(self, name: typing.Union[typing_extensions.Literal["myNumber", " def get_item_oapg(self, name: typing_extensions.Literal["myNumber"]) -> typing.Union['NumberWithValidations', schemas.Unset]: ... @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["myString"]) -> typing.Union[MetaOapg.properties.myString, schemas.Unset]: ... + def get_item_oapg(self, name: typing_extensions.Literal["myString"]) -> typing.Union['String', schemas.Unset]: ... @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["myBoolean"]) -> typing.Union[MetaOapg.properties.myBoolean, schemas.Unset]: ... + def get_item_oapg(self, name: typing_extensions.Literal["myBoolean"]) -> typing.Union['Boolean', schemas.Unset]: ... @typing.overload def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... @@ -87,8 +93,8 @@ def __new__( cls, *args: typing.Union[dict, frozendict.frozendict, ], myNumber: typing.Union['NumberWithValidations', schemas.Unset] = schemas.unset, - myString: typing.Union[MetaOapg.properties.myString, str, schemas.Unset] = schemas.unset, - myBoolean: typing.Union[MetaOapg.properties.myBoolean, bool, schemas.Unset] = schemas.unset, + myString: typing.Union['String', schemas.Unset] = schemas.unset, + myBoolean: typing.Union['Boolean', schemas.Unset] = schemas.unset, _configuration: typing.Optional[schemas.Configuration] = None, **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], ) -> 'ObjectModelWithRefProps': @@ -102,4 +108,6 @@ def __new__( **kwargs, ) +from petstore_api.model.boolean import Boolean from petstore_api.model.number_with_validations import NumberWithValidations +from petstore_api.model.string import String diff --git a/samples/openapi3/client/petstore/python/petstore_api/model/object_model_with_ref_props.pyi b/samples/openapi3/client/petstore/python/petstore_api/model/object_model_with_ref_props.pyi index e68caff8717..b3ab14ba2d5 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/model/object_model_with_ref_props.pyi +++ b/samples/openapi3/client/petstore/python/petstore_api/model/object_model_with_ref_props.pyi @@ -42,8 +42,14 @@ class ObjectModelWithRefProps( @staticmethod def myNumber() -> typing.Type['NumberWithValidations']: return NumberWithValidations - myString = schemas.StrSchema - myBoolean = schemas.BoolSchema + + @staticmethod + def myString() -> typing.Type['String']: + return String + + @staticmethod + def myBoolean() -> typing.Type['Boolean']: + return Boolean __annotations__ = { "myNumber": myNumber, "myString": myString, @@ -54,10 +60,10 @@ class ObjectModelWithRefProps( def __getitem__(self, name: typing_extensions.Literal["myNumber"]) -> 'NumberWithValidations': ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["myString"]) -> MetaOapg.properties.myString: ... + def __getitem__(self, name: typing_extensions.Literal["myString"]) -> 'String': ... @typing.overload - def __getitem__(self, name: typing_extensions.Literal["myBoolean"]) -> MetaOapg.properties.myBoolean: ... + def __getitem__(self, name: typing_extensions.Literal["myBoolean"]) -> 'Boolean': ... @typing.overload def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... @@ -71,10 +77,10 @@ class ObjectModelWithRefProps( def get_item_oapg(self, name: typing_extensions.Literal["myNumber"]) -> typing.Union['NumberWithValidations', schemas.Unset]: ... @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["myString"]) -> typing.Union[MetaOapg.properties.myString, schemas.Unset]: ... + def get_item_oapg(self, name: typing_extensions.Literal["myString"]) -> typing.Union['String', schemas.Unset]: ... @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["myBoolean"]) -> typing.Union[MetaOapg.properties.myBoolean, schemas.Unset]: ... + def get_item_oapg(self, name: typing_extensions.Literal["myBoolean"]) -> typing.Union['Boolean', schemas.Unset]: ... @typing.overload def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... @@ -87,8 +93,8 @@ class ObjectModelWithRefProps( cls, *args: typing.Union[dict, frozendict.frozendict, ], myNumber: typing.Union['NumberWithValidations', schemas.Unset] = schemas.unset, - myString: typing.Union[MetaOapg.properties.myString, str, schemas.Unset] = schemas.unset, - myBoolean: typing.Union[MetaOapg.properties.myBoolean, bool, schemas.Unset] = schemas.unset, + myString: typing.Union['String', schemas.Unset] = schemas.unset, + myBoolean: typing.Union['Boolean', schemas.Unset] = schemas.unset, _configuration: typing.Optional[schemas.Configuration] = None, **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], ) -> 'ObjectModelWithRefProps': @@ -102,4 +108,6 @@ class ObjectModelWithRefProps( **kwargs, ) +from petstore_api.model.boolean import Boolean from petstore_api.model.number_with_validations import NumberWithValidations +from petstore_api.model.string import String diff --git a/samples/openapi3/client/petstore/python/petstore_api/model/object_with_decimal_properties.py b/samples/openapi3/client/petstore/python/petstore_api/model/object_with_decimal_properties.py index 068f21457bc..20d1a1e18ca 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/model/object_with_decimal_properties.py +++ b/samples/openapi3/client/petstore/python/petstore_api/model/object_with_decimal_properties.py @@ -36,7 +36,10 @@ class ObjectWithDecimalProperties( class MetaOapg: class properties: - length = schemas.DecimalSchema + + @staticmethod + def length() -> typing.Type['DecimalPayload']: + return DecimalPayload width = schemas.DecimalSchema @staticmethod @@ -49,7 +52,7 @@ def cost() -> typing.Type['Money']: } @typing.overload - def __getitem__(self, name: typing_extensions.Literal["length"]) -> MetaOapg.properties.length: ... + def __getitem__(self, name: typing_extensions.Literal["length"]) -> 'DecimalPayload': ... @typing.overload def __getitem__(self, name: typing_extensions.Literal["width"]) -> MetaOapg.properties.width: ... @@ -66,7 +69,7 @@ def __getitem__(self, name: typing.Union[typing_extensions.Literal["length", "wi @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["length"]) -> typing.Union[MetaOapg.properties.length, schemas.Unset]: ... + def get_item_oapg(self, name: typing_extensions.Literal["length"]) -> typing.Union['DecimalPayload', schemas.Unset]: ... @typing.overload def get_item_oapg(self, name: typing_extensions.Literal["width"]) -> typing.Union[MetaOapg.properties.width, schemas.Unset]: ... @@ -84,7 +87,7 @@ def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["length", " def __new__( cls, *args: typing.Union[dict, frozendict.frozendict, ], - length: typing.Union[MetaOapg.properties.length, str, schemas.Unset] = schemas.unset, + length: typing.Union['DecimalPayload', schemas.Unset] = schemas.unset, width: typing.Union[MetaOapg.properties.width, str, schemas.Unset] = schemas.unset, cost: typing.Union['Money', schemas.Unset] = schemas.unset, _configuration: typing.Optional[schemas.Configuration] = None, @@ -100,4 +103,5 @@ def __new__( **kwargs, ) +from petstore_api.model.decimal_payload import DecimalPayload from petstore_api.model.money import Money diff --git a/samples/openapi3/client/petstore/python/petstore_api/model/object_with_decimal_properties.pyi b/samples/openapi3/client/petstore/python/petstore_api/model/object_with_decimal_properties.pyi index 068f21457bc..20d1a1e18ca 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/model/object_with_decimal_properties.pyi +++ b/samples/openapi3/client/petstore/python/petstore_api/model/object_with_decimal_properties.pyi @@ -36,7 +36,10 @@ class ObjectWithDecimalProperties( class MetaOapg: class properties: - length = schemas.DecimalSchema + + @staticmethod + def length() -> typing.Type['DecimalPayload']: + return DecimalPayload width = schemas.DecimalSchema @staticmethod @@ -49,7 +52,7 @@ class ObjectWithDecimalProperties( } @typing.overload - def __getitem__(self, name: typing_extensions.Literal["length"]) -> MetaOapg.properties.length: ... + def __getitem__(self, name: typing_extensions.Literal["length"]) -> 'DecimalPayload': ... @typing.overload def __getitem__(self, name: typing_extensions.Literal["width"]) -> MetaOapg.properties.width: ... @@ -66,7 +69,7 @@ class ObjectWithDecimalProperties( @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["length"]) -> typing.Union[MetaOapg.properties.length, schemas.Unset]: ... + def get_item_oapg(self, name: typing_extensions.Literal["length"]) -> typing.Union['DecimalPayload', schemas.Unset]: ... @typing.overload def get_item_oapg(self, name: typing_extensions.Literal["width"]) -> typing.Union[MetaOapg.properties.width, schemas.Unset]: ... @@ -84,7 +87,7 @@ class ObjectWithDecimalProperties( def __new__( cls, *args: typing.Union[dict, frozendict.frozendict, ], - length: typing.Union[MetaOapg.properties.length, str, schemas.Unset] = schemas.unset, + length: typing.Union['DecimalPayload', schemas.Unset] = schemas.unset, width: typing.Union[MetaOapg.properties.width, str, schemas.Unset] = schemas.unset, cost: typing.Union['Money', schemas.Unset] = schemas.unset, _configuration: typing.Optional[schemas.Configuration] = None, @@ -100,4 +103,5 @@ class ObjectWithDecimalProperties( **kwargs, ) +from petstore_api.model.decimal_payload import DecimalPayload from petstore_api.model.money import Money diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/another_fake_dummy/patch.py b/samples/openapi3/client/petstore/python/petstore_api/paths/another_fake_dummy/patch.py deleted file mode 100644 index 35b18c4fde2..00000000000 --- a/samples/openapi3/client/petstore/python/petstore_api/paths/another_fake_dummy/patch.py +++ /dev/null @@ -1,329 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from petstore_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from petstore_api import schemas # noqa: F401 - -from petstore_api.model.client import Client - -from . import path - -# body param -SchemaForRequestBodyApplicationJson = Client - - -request_body_client = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) -SchemaFor200ResponseBodyApplicationJson = Client - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_status_code_to_response = { - '200': _response_for_200, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _call_123_test_special_tags_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _call_123_test_special_tags_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _call_123_test_special_tags_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _call_123_test_special_tags_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _call_123_test_special_tags_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - To test special tags - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_client.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='patch'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class Call123TestSpecialTags(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def call_123_test_special_tags( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def call_123_test_special_tags( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def call_123_test_special_tags( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def call_123_test_special_tags( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def call_123_test_special_tags( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._call_123_test_special_tags_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpatch(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def patch( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def patch( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def patch( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def patch( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def patch( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._call_123_test_special_tags_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/another_fake_dummy/patch.pyi b/samples/openapi3/client/petstore/python/petstore_api/paths/another_fake_dummy/patch.pyi deleted file mode 100644 index 5c7dfa48515..00000000000 --- a/samples/openapi3/client/petstore/python/petstore_api/paths/another_fake_dummy/patch.pyi +++ /dev/null @@ -1,324 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from petstore_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from petstore_api import schemas # noqa: F401 - -from petstore_api.model.client import Client - -# body param -SchemaForRequestBodyApplicationJson = Client - - -request_body_client = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) -SchemaFor200ResponseBodyApplicationJson = Client - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _call_123_test_special_tags_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _call_123_test_special_tags_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _call_123_test_special_tags_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _call_123_test_special_tags_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _call_123_test_special_tags_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - To test special tags - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_client.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='patch'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class Call123TestSpecialTags(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def call_123_test_special_tags( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def call_123_test_special_tags( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def call_123_test_special_tags( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def call_123_test_special_tags( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def call_123_test_special_tags( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._call_123_test_special_tags_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpatch(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def patch( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def patch( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def patch( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def patch( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def patch( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._call_123_test_special_tags_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/another_fake_dummy/patch/__init__.py b/samples/openapi3/client/petstore/python/petstore_api/paths/another_fake_dummy/patch/__init__.py new file mode 100644 index 00000000000..cc0b963ae49 --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/another_fake_dummy/patch/__init__.py @@ -0,0 +1,315 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from petstore_api.model.client import Client + +from .. import path +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = Client + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _call_123_test_special_tags_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _call_123_test_special_tags_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _call_123_test_special_tags_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _call_123_test_special_tags_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _call_123_test_special_tags_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + To test special tags + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='patch'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class Call123TestSpecialTags(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def call_123_test_special_tags( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def call_123_test_special_tags( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def call_123_test_special_tags( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def call_123_test_special_tags( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def call_123_test_special_tags( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._call_123_test_special_tags_oapg( + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpatch(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def patch( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def patch( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def patch( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def patch( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def patch( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._call_123_test_special_tags_oapg( + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/another_fake_dummy/patch/__init__.pyi b/samples/openapi3/client/petstore/python/petstore_api/paths/another_fake_dummy/patch/__init__.pyi new file mode 100644 index 00000000000..dd08623d0c0 --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/another_fake_dummy/patch/__init__.pyi @@ -0,0 +1,310 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from petstore_api.model.client import Client + +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = Client + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _call_123_test_special_tags_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _call_123_test_special_tags_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _call_123_test_special_tags_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _call_123_test_special_tags_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _call_123_test_special_tags_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + To test special tags + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='patch'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class Call123TestSpecialTags(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def call_123_test_special_tags( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def call_123_test_special_tags( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def call_123_test_special_tags( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def call_123_test_special_tags( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def call_123_test_special_tags( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._call_123_test_special_tags_oapg( + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpatch(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def patch( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def patch( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def patch( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def patch( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def patch( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._call_123_test_special_tags_oapg( + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/another_fake_dummy/patch/response_for_200.py b/samples/openapi3/client/petstore/python/petstore_api/paths/another_fake_dummy/patch/response_for_200.py new file mode 100644 index 00000000000..d54e97d5447 --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/another_fake_dummy/patch/response_for_200.py @@ -0,0 +1,43 @@ +import dataclasses +import urllib3 + +from petstore_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from petstore_api.model.client import Client + + +class BodySchemas: + # body schemas + application_json = Client + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake/delete.py b/samples/openapi3/client/petstore/python/petstore_api/paths/fake/delete.py deleted file mode 100644 index 9803516eec2..00000000000 --- a/samples/openapi3/client/petstore/python/petstore_api/paths/fake/delete.py +++ /dev/null @@ -1,350 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from petstore_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from petstore_api import schemas # noqa: F401 - -from . import path - -# Query params -RequiredStringGroupSchema = schemas.IntSchema -RequiredInt64GroupSchema = schemas.Int64Schema -StringGroupSchema = schemas.IntSchema -Int64GroupSchema = schemas.Int64Schema -RequestRequiredQueryParams = typing_extensions.TypedDict( - 'RequestRequiredQueryParams', - { - 'required_string_group': typing.Union[RequiredStringGroupSchema, decimal.Decimal, int, ], - 'required_int64_group': typing.Union[RequiredInt64GroupSchema, decimal.Decimal, int, ], - } -) -RequestOptionalQueryParams = typing_extensions.TypedDict( - 'RequestOptionalQueryParams', - { - 'string_group': typing.Union[StringGroupSchema, decimal.Decimal, int, ], - 'int64_group': typing.Union[Int64GroupSchema, decimal.Decimal, int, ], - }, - total=False -) - - -class RequestQueryParams(RequestRequiredQueryParams, RequestOptionalQueryParams): - pass - - -request_query_required_string_group = api_client.QueryParameter( - name="required_string_group", - style=api_client.ParameterStyle.FORM, - schema=RequiredStringGroupSchema, - required=True, - explode=True, -) -request_query_required_int64_group = api_client.QueryParameter( - name="required_int64_group", - style=api_client.ParameterStyle.FORM, - schema=RequiredInt64GroupSchema, - required=True, - explode=True, -) -request_query_string_group = api_client.QueryParameter( - name="string_group", - style=api_client.ParameterStyle.FORM, - schema=StringGroupSchema, - explode=True, -) -request_query_int64_group = api_client.QueryParameter( - name="int64_group", - style=api_client.ParameterStyle.FORM, - schema=Int64GroupSchema, - explode=True, -) -# Header params -RequiredBooleanGroupSchema = schemas.BoolSchema -BooleanGroupSchema = schemas.BoolSchema -RequestRequiredHeaderParams = typing_extensions.TypedDict( - 'RequestRequiredHeaderParams', - { - 'required_boolean_group': typing.Union[RequiredBooleanGroupSchema, bool, ], - } -) -RequestOptionalHeaderParams = typing_extensions.TypedDict( - 'RequestOptionalHeaderParams', - { - 'boolean_group': typing.Union[BooleanGroupSchema, bool, ], - }, - total=False -) - - -class RequestHeaderParams(RequestRequiredHeaderParams, RequestOptionalHeaderParams): - pass - - -request_header_required_boolean_group = api_client.HeaderParameter( - name="required_boolean_group", - style=api_client.ParameterStyle.SIMPLE, - schema=RequiredBooleanGroupSchema, - required=True, -) -request_header_boolean_group = api_client.HeaderParameter( - name="boolean_group", - style=api_client.ParameterStyle.SIMPLE, - schema=BooleanGroupSchema, -) -_auth = [ - 'bearer_test', -] - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) -_status_code_to_response = { - '200': _response_for_200, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _group_parameters_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - header_params: RequestHeaderParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _group_parameters_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - query_params: RequestQueryParams = frozendict.frozendict(), - header_params: RequestHeaderParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _group_parameters_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - header_params: RequestHeaderParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _group_parameters_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - header_params: RequestHeaderParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - Fake endpoint to test group parameters (optional) - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - self._verify_typed_dict_inputs_oapg(RequestQueryParams, query_params) - self._verify_typed_dict_inputs_oapg(RequestHeaderParams, header_params) - used_path = path.value - - prefix_separator_iterator = None - for parameter in ( - request_query_required_string_group, - request_query_required_int64_group, - request_query_string_group, - request_query_int64_group, - ): - parameter_data = query_params.get(parameter.name, schemas.unset) - if parameter_data is schemas.unset: - continue - if prefix_separator_iterator is None: - prefix_separator_iterator = parameter.get_prefix_separator_iterator() - serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) - for serialized_value in serialized_data.values(): - used_path += serialized_value - - _headers = HTTPHeaderDict() - for parameter in ( - request_header_required_boolean_group, - request_header_boolean_group, - ): - parameter_data = header_params.get(parameter.name, schemas.unset) - if parameter_data is schemas.unset: - continue - serialized_data = parameter.serialize(parameter_data) - _headers.extend(serialized_data) - # TODO add cookie handling - - response = self.api_client.call_api( - resource_path=used_path, - method='delete'.upper(), - headers=_headers, - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class GroupParameters(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def group_parameters( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - header_params: RequestHeaderParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def group_parameters( - self, - skip_deserialization: typing_extensions.Literal[True], - query_params: RequestQueryParams = frozendict.frozendict(), - header_params: RequestHeaderParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def group_parameters( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - header_params: RequestHeaderParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def group_parameters( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - header_params: RequestHeaderParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._group_parameters_oapg( - query_params=query_params, - header_params=header_params, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiFordelete(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def delete( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - header_params: RequestHeaderParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def delete( - self, - skip_deserialization: typing_extensions.Literal[True], - query_params: RequestQueryParams = frozendict.frozendict(), - header_params: RequestHeaderParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def delete( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - header_params: RequestHeaderParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def delete( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - header_params: RequestHeaderParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._group_parameters_oapg( - query_params=query_params, - header_params=header_params, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake/delete.pyi b/samples/openapi3/client/petstore/python/petstore_api/paths/fake/delete.pyi deleted file mode 100644 index 1bb21445f6f..00000000000 --- a/samples/openapi3/client/petstore/python/petstore_api/paths/fake/delete.pyi +++ /dev/null @@ -1,342 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from petstore_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from petstore_api import schemas # noqa: F401 - -# Query params -RequiredStringGroupSchema = schemas.IntSchema -RequiredInt64GroupSchema = schemas.Int64Schema -StringGroupSchema = schemas.IntSchema -Int64GroupSchema = schemas.Int64Schema -RequestRequiredQueryParams = typing_extensions.TypedDict( - 'RequestRequiredQueryParams', - { - 'required_string_group': typing.Union[RequiredStringGroupSchema, decimal.Decimal, int, ], - 'required_int64_group': typing.Union[RequiredInt64GroupSchema, decimal.Decimal, int, ], - } -) -RequestOptionalQueryParams = typing_extensions.TypedDict( - 'RequestOptionalQueryParams', - { - 'string_group': typing.Union[StringGroupSchema, decimal.Decimal, int, ], - 'int64_group': typing.Union[Int64GroupSchema, decimal.Decimal, int, ], - }, - total=False -) - - -class RequestQueryParams(RequestRequiredQueryParams, RequestOptionalQueryParams): - pass - - -request_query_required_string_group = api_client.QueryParameter( - name="required_string_group", - style=api_client.ParameterStyle.FORM, - schema=RequiredStringGroupSchema, - required=True, - explode=True, -) -request_query_required_int64_group = api_client.QueryParameter( - name="required_int64_group", - style=api_client.ParameterStyle.FORM, - schema=RequiredInt64GroupSchema, - required=True, - explode=True, -) -request_query_string_group = api_client.QueryParameter( - name="string_group", - style=api_client.ParameterStyle.FORM, - schema=StringGroupSchema, - explode=True, -) -request_query_int64_group = api_client.QueryParameter( - name="int64_group", - style=api_client.ParameterStyle.FORM, - schema=Int64GroupSchema, - explode=True, -) -# Header params -RequiredBooleanGroupSchema = schemas.BoolSchema -BooleanGroupSchema = schemas.BoolSchema -RequestRequiredHeaderParams = typing_extensions.TypedDict( - 'RequestRequiredHeaderParams', - { - 'required_boolean_group': typing.Union[RequiredBooleanGroupSchema, bool, ], - } -) -RequestOptionalHeaderParams = typing_extensions.TypedDict( - 'RequestOptionalHeaderParams', - { - 'boolean_group': typing.Union[BooleanGroupSchema, bool, ], - }, - total=False -) - - -class RequestHeaderParams(RequestRequiredHeaderParams, RequestOptionalHeaderParams): - pass - - -request_header_required_boolean_group = api_client.HeaderParameter( - name="required_boolean_group", - style=api_client.ParameterStyle.SIMPLE, - schema=RequiredBooleanGroupSchema, - required=True, -) -request_header_boolean_group = api_client.HeaderParameter( - name="boolean_group", - style=api_client.ParameterStyle.SIMPLE, - schema=BooleanGroupSchema, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _group_parameters_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - header_params: RequestHeaderParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _group_parameters_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - query_params: RequestQueryParams = frozendict.frozendict(), - header_params: RequestHeaderParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _group_parameters_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - header_params: RequestHeaderParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _group_parameters_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - header_params: RequestHeaderParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - Fake endpoint to test group parameters (optional) - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - self._verify_typed_dict_inputs_oapg(RequestQueryParams, query_params) - self._verify_typed_dict_inputs_oapg(RequestHeaderParams, header_params) - used_path = path.value - - prefix_separator_iterator = None - for parameter in ( - request_query_required_string_group, - request_query_required_int64_group, - request_query_string_group, - request_query_int64_group, - ): - parameter_data = query_params.get(parameter.name, schemas.unset) - if parameter_data is schemas.unset: - continue - if prefix_separator_iterator is None: - prefix_separator_iterator = parameter.get_prefix_separator_iterator() - serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) - for serialized_value in serialized_data.values(): - used_path += serialized_value - - _headers = HTTPHeaderDict() - for parameter in ( - request_header_required_boolean_group, - request_header_boolean_group, - ): - parameter_data = header_params.get(parameter.name, schemas.unset) - if parameter_data is schemas.unset: - continue - serialized_data = parameter.serialize(parameter_data) - _headers.extend(serialized_data) - # TODO add cookie handling - - response = self.api_client.call_api( - resource_path=used_path, - method='delete'.upper(), - headers=_headers, - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class GroupParameters(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def group_parameters( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - header_params: RequestHeaderParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def group_parameters( - self, - skip_deserialization: typing_extensions.Literal[True], - query_params: RequestQueryParams = frozendict.frozendict(), - header_params: RequestHeaderParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def group_parameters( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - header_params: RequestHeaderParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def group_parameters( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - header_params: RequestHeaderParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._group_parameters_oapg( - query_params=query_params, - header_params=header_params, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiFordelete(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def delete( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - header_params: RequestHeaderParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def delete( - self, - skip_deserialization: typing_extensions.Literal[True], - query_params: RequestQueryParams = frozendict.frozendict(), - header_params: RequestHeaderParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def delete( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - header_params: RequestHeaderParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def delete( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - header_params: RequestHeaderParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._group_parameters_oapg( - query_params=query_params, - header_params=header_params, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake/delete/__init__.py b/samples/openapi3/client/petstore/python/petstore_api/paths/fake/delete/__init__.py new file mode 100644 index 00000000000..da048e81b67 --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/fake/delete/__init__.py @@ -0,0 +1,345 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 + + + +class RequestQueryParameters: + class Schemas: + required_string_group = schemas.IntSchema + required_int64_group = schemas.Int64Schema + string_group = schemas.IntSchema + int64_group = schemas.Int64Schema + + + RequiredParams = typing_extensions.TypedDict( + 'RequiredParams', + { + 'required_string_group': typing.Union[Schemas.required_string_group, decimal.Decimal, int, ], + 'required_int64_group': typing.Union[Schemas.required_int64_group, decimal.Decimal, int, ], + } + ) + OptionalParams = typing_extensions.TypedDict( + 'OptionalParams', + { + 'string_group': typing.Union[Schemas.string_group, decimal.Decimal, int, ], + 'int64_group': typing.Union[Schemas.int64_group, decimal.Decimal, int, ], + }, + total=False + ) + + + class Params(RequiredParams, OptionalParams): + pass + + + parameters = [ + api_client.QueryParameter( + name="required_string_group", + style=api_client.ParameterStyle.FORM, + schema=Schemas.required_string_group, + required=True, + explode=True, + ), + api_client.QueryParameter( + name="required_int64_group", + style=api_client.ParameterStyle.FORM, + schema=Schemas.required_int64_group, + required=True, + explode=True, + ), + api_client.QueryParameter( + name="string_group", + style=api_client.ParameterStyle.FORM, + schema=Schemas.string_group, + explode=True, + ), + api_client.QueryParameter( + name="int64_group", + style=api_client.ParameterStyle.FORM, + schema=Schemas.int64_group, + explode=True, + ), + ] + +class RequestHeaderParameters: + class Schemas: + required_boolean_group = schemas.BoolSchema + boolean_group = schemas.BoolSchema + + + RequiredParams = typing_extensions.TypedDict( + 'RequiredParams', + { + 'required_boolean_group': typing.Union[Schemas.required_boolean_group, bool, ], + } + ) + OptionalParams = typing_extensions.TypedDict( + 'OptionalParams', + { + 'boolean_group': typing.Union[Schemas.boolean_group, bool, ], + }, + total=False + ) + + + class Params(RequiredParams, OptionalParams): + pass + + + parameters = [ + api_client.HeaderParameter( + name="required_boolean_group", + style=api_client.ParameterStyle.SIMPLE, + schema=Schemas.required_boolean_group, + required=True, + ), + api_client.HeaderParameter( + name="boolean_group", + style=api_client.ParameterStyle.SIMPLE, + schema=Schemas.boolean_group, + ), + ] +_auth = [ + 'bearer_test', +] + +_status_code_to_response = { + '200': response_for_200.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _group_parameters_oapg( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + header_params: RequestHeaderParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _group_parameters_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + header_params: RequestHeaderParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _group_parameters_oapg( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + header_params: RequestHeaderParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _group_parameters_oapg( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + header_params: RequestHeaderParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + Fake endpoint to test group parameters (optional) + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + self._verify_typed_dict_inputs_oapg(RequestQueryParameters.Params, query_params) + self._verify_typed_dict_inputs_oapg(RequestHeaderParameters.Params, header_params) + used_path = path.value + + prefix_separator_iterator = None + for parameter in RequestQueryParameters.parameters: + parameter_data = query_params.get(parameter.name, schemas.unset) + if parameter_data is schemas.unset: + continue + if prefix_separator_iterator is None: + prefix_separator_iterator = parameter.get_prefix_separator_iterator() + serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) + for serialized_value in serialized_data.values(): + used_path += serialized_value + + _headers = HTTPHeaderDict() + for parameter in RequestHeaderParameters.parameters: + parameter_data = header_params.get(parameter.name, schemas.unset) + if parameter_data is schemas.unset: + continue + serialized_data = parameter.serialize(parameter_data) + _headers.extend(serialized_data) + # TODO add cookie handling + + response = self.api_client.call_api( + resource_path=used_path, + method='delete'.upper(), + headers=_headers, + auth_settings=_auth, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class GroupParameters(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def group_parameters( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + header_params: RequestHeaderParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def group_parameters( + self, + skip_deserialization: typing_extensions.Literal[True], + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + header_params: RequestHeaderParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def group_parameters( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + header_params: RequestHeaderParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def group_parameters( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + header_params: RequestHeaderParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._group_parameters_oapg( + query_params=query_params, + header_params=header_params, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiFordelete(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def delete( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + header_params: RequestHeaderParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def delete( + self, + skip_deserialization: typing_extensions.Literal[True], + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + header_params: RequestHeaderParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def delete( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + header_params: RequestHeaderParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def delete( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + header_params: RequestHeaderParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._group_parameters_oapg( + query_params=query_params, + header_params=header_params, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake/delete/__init__.pyi b/samples/openapi3/client/petstore/python/petstore_api/paths/fake/delete/__init__.pyi new file mode 100644 index 00000000000..14768ee0b6a --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/fake/delete/__init__.pyi @@ -0,0 +1,336 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from . import response_for_200 + + + +class RequestQueryParameters: + class Schemas: + required_string_group = schemas.IntSchema + required_int64_group = schemas.Int64Schema + string_group = schemas.IntSchema + int64_group = schemas.Int64Schema + + + RequiredParams = typing_extensions.TypedDict( + 'RequiredParams', + { + 'required_string_group': typing.Union[Schemas.required_string_group, decimal.Decimal, int, ], + 'required_int64_group': typing.Union[Schemas.required_int64_group, decimal.Decimal, int, ], + } + ) + OptionalParams = typing_extensions.TypedDict( + 'OptionalParams', + { + 'string_group': typing.Union[Schemas.string_group, decimal.Decimal, int, ], + 'int64_group': typing.Union[Schemas.int64_group, decimal.Decimal, int, ], + }, + total=False + ) + + + class Params(RequiredParams, OptionalParams): + pass + + + parameters = [ + api_client.QueryParameter( + name="required_string_group", + style=api_client.ParameterStyle.FORM, + schema=Schemas.required_string_group, + required=True, + explode=True, + ), + api_client.QueryParameter( + name="required_int64_group", + style=api_client.ParameterStyle.FORM, + schema=Schemas.required_int64_group, + required=True, + explode=True, + ), + api_client.QueryParameter( + name="string_group", + style=api_client.ParameterStyle.FORM, + schema=Schemas.string_group, + explode=True, + ), + api_client.QueryParameter( + name="int64_group", + style=api_client.ParameterStyle.FORM, + schema=Schemas.int64_group, + explode=True, + ), + ] + +class RequestHeaderParameters: + class Schemas: + required_boolean_group = schemas.BoolSchema + boolean_group = schemas.BoolSchema + + + RequiredParams = typing_extensions.TypedDict( + 'RequiredParams', + { + 'required_boolean_group': typing.Union[Schemas.required_boolean_group, bool, ], + } + ) + OptionalParams = typing_extensions.TypedDict( + 'OptionalParams', + { + 'boolean_group': typing.Union[Schemas.boolean_group, bool, ], + }, + total=False + ) + + + class Params(RequiredParams, OptionalParams): + pass + + + parameters = [ + api_client.HeaderParameter( + name="required_boolean_group", + style=api_client.ParameterStyle.SIMPLE, + schema=Schemas.required_boolean_group, + required=True, + ), + api_client.HeaderParameter( + name="boolean_group", + style=api_client.ParameterStyle.SIMPLE, + schema=Schemas.boolean_group, + ), + ] + +class BaseApi(api_client.Api): + @typing.overload + def _group_parameters_oapg( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + header_params: RequestHeaderParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _group_parameters_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + header_params: RequestHeaderParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _group_parameters_oapg( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + header_params: RequestHeaderParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _group_parameters_oapg( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + header_params: RequestHeaderParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + Fake endpoint to test group parameters (optional) + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + self._verify_typed_dict_inputs_oapg(RequestQueryParameters.Params, query_params) + self._verify_typed_dict_inputs_oapg(RequestHeaderParameters.Params, header_params) + used_path = path.value + + prefix_separator_iterator = None + for parameter in RequestQueryParameters.parameters: + parameter_data = query_params.get(parameter.name, schemas.unset) + if parameter_data is schemas.unset: + continue + if prefix_separator_iterator is None: + prefix_separator_iterator = parameter.get_prefix_separator_iterator() + serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) + for serialized_value in serialized_data.values(): + used_path += serialized_value + + _headers = HTTPHeaderDict() + for parameter in RequestHeaderParameters.parameters: + parameter_data = header_params.get(parameter.name, schemas.unset) + if parameter_data is schemas.unset: + continue + serialized_data = parameter.serialize(parameter_data) + _headers.extend(serialized_data) + # TODO add cookie handling + + response = self.api_client.call_api( + resource_path=used_path, + method='delete'.upper(), + headers=_headers, + auth_settings=_auth, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class GroupParameters(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def group_parameters( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + header_params: RequestHeaderParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def group_parameters( + self, + skip_deserialization: typing_extensions.Literal[True], + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + header_params: RequestHeaderParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def group_parameters( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + header_params: RequestHeaderParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def group_parameters( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + header_params: RequestHeaderParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._group_parameters_oapg( + query_params=query_params, + header_params=header_params, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiFordelete(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def delete( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + header_params: RequestHeaderParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def delete( + self, + skip_deserialization: typing_extensions.Literal[True], + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + header_params: RequestHeaderParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def delete( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + header_params: RequestHeaderParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def delete( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + header_params: RequestHeaderParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._group_parameters_oapg( + query_params=query_params, + header_params=header_params, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake/delete/response_for_200.py b/samples/openapi3/client/petstore/python/petstore_api/paths/fake/delete/response_for_200.py new file mode 100644 index 00000000000..7ec95a8627a --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/fake/delete/response_for_200.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from petstore_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake/get.py b/samples/openapi3/client/petstore/python/petstore_api/paths/fake/get.py deleted file mode 100644 index f56f26eac5f..00000000000 --- a/samples/openapi3/client/petstore/python/petstore_api/paths/fake/get.py +++ /dev/null @@ -1,752 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from petstore_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from petstore_api import schemas # noqa: F401 - -from . import path - -# Query params - - -class EnumQueryStringArraySchema( - schemas.ListSchema -): - - - class MetaOapg: - - - class items( - schemas.EnumBase, - schemas.StrSchema - ): - - - class MetaOapg: - enum_value_to_name = { - ">": "GREATER_THAN", - "$": "DOLLAR", - } - - @schemas.classproperty - def GREATER_THAN(cls): - return cls(">") - - @schemas.classproperty - def DOLLAR(cls): - return cls("$") - - def __new__( - cls, - arg: typing.Union[typing.Tuple[typing.Union[MetaOapg.items, str, ]], typing.List[typing.Union[MetaOapg.items, str, ]]], - _configuration: typing.Optional[schemas.Configuration] = None, - ) -> 'EnumQueryStringArraySchema': - return super().__new__( - cls, - arg, - _configuration=_configuration, - ) - - def __getitem__(self, i: int) -> MetaOapg.items: - return super().__getitem__(i) - - -class EnumQueryStringSchema( - schemas.EnumBase, - schemas.StrSchema -): - - - class MetaOapg: - enum_value_to_name = { - "_abc": "_ABC", - "-efg": "EFG", - "(xyz)": "XYZ", - } - - @schemas.classproperty - def _ABC(cls): - return cls("_abc") - - @schemas.classproperty - def EFG(cls): - return cls("-efg") - - @schemas.classproperty - def XYZ(cls): - return cls("(xyz)") - - -class EnumQueryIntegerSchema( - schemas.EnumBase, - schemas.Int32Schema -): - - - class MetaOapg: - format = 'int32' - enum_value_to_name = { - 1: "POSITIVE_1", - -2: "NEGATIVE_2", - } - - @schemas.classproperty - def POSITIVE_1(cls): - return cls(1) - - @schemas.classproperty - def NEGATIVE_2(cls): - return cls(-2) - - -class EnumQueryDoubleSchema( - schemas.EnumBase, - schemas.Float64Schema -): - - - class MetaOapg: - format = 'double' - enum_value_to_name = { - 1.1: "POSITIVE_1_PT_1", - -1.2: "NEGATIVE_1_PT_2", - } - - @schemas.classproperty - def POSITIVE_1_PT_1(cls): - return cls(1.1) - - @schemas.classproperty - def NEGATIVE_1_PT_2(cls): - return cls(-1.2) -RequestRequiredQueryParams = typing_extensions.TypedDict( - 'RequestRequiredQueryParams', - { - } -) -RequestOptionalQueryParams = typing_extensions.TypedDict( - 'RequestOptionalQueryParams', - { - 'enum_query_string_array': typing.Union[EnumQueryStringArraySchema, list, tuple, ], - 'enum_query_string': typing.Union[EnumQueryStringSchema, str, ], - 'enum_query_integer': typing.Union[EnumQueryIntegerSchema, decimal.Decimal, int, ], - 'enum_query_double': typing.Union[EnumQueryDoubleSchema, decimal.Decimal, int, float, ], - }, - total=False -) - - -class RequestQueryParams(RequestRequiredQueryParams, RequestOptionalQueryParams): - pass - - -request_query_enum_query_string_array = api_client.QueryParameter( - name="enum_query_string_array", - style=api_client.ParameterStyle.FORM, - schema=EnumQueryStringArraySchema, - explode=True, -) -request_query_enum_query_string = api_client.QueryParameter( - name="enum_query_string", - style=api_client.ParameterStyle.FORM, - schema=EnumQueryStringSchema, - explode=True, -) -request_query_enum_query_integer = api_client.QueryParameter( - name="enum_query_integer", - style=api_client.ParameterStyle.FORM, - schema=EnumQueryIntegerSchema, - explode=True, -) -request_query_enum_query_double = api_client.QueryParameter( - name="enum_query_double", - style=api_client.ParameterStyle.FORM, - schema=EnumQueryDoubleSchema, - explode=True, -) -# Header params - - -class EnumHeaderStringArraySchema( - schemas.ListSchema -): - - - class MetaOapg: - - - class items( - schemas.EnumBase, - schemas.StrSchema - ): - - - class MetaOapg: - enum_value_to_name = { - ">": "GREATER_THAN", - "$": "DOLLAR", - } - - @schemas.classproperty - def GREATER_THAN(cls): - return cls(">") - - @schemas.classproperty - def DOLLAR(cls): - return cls("$") - - def __new__( - cls, - arg: typing.Union[typing.Tuple[typing.Union[MetaOapg.items, str, ]], typing.List[typing.Union[MetaOapg.items, str, ]]], - _configuration: typing.Optional[schemas.Configuration] = None, - ) -> 'EnumHeaderStringArraySchema': - return super().__new__( - cls, - arg, - _configuration=_configuration, - ) - - def __getitem__(self, i: int) -> MetaOapg.items: - return super().__getitem__(i) - - -class EnumHeaderStringSchema( - schemas.EnumBase, - schemas.StrSchema -): - - - class MetaOapg: - enum_value_to_name = { - "_abc": "_ABC", - "-efg": "EFG", - "(xyz)": "XYZ", - } - - @schemas.classproperty - def _ABC(cls): - return cls("_abc") - - @schemas.classproperty - def EFG(cls): - return cls("-efg") - - @schemas.classproperty - def XYZ(cls): - return cls("(xyz)") -RequestRequiredHeaderParams = typing_extensions.TypedDict( - 'RequestRequiredHeaderParams', - { - } -) -RequestOptionalHeaderParams = typing_extensions.TypedDict( - 'RequestOptionalHeaderParams', - { - 'enum_header_string_array': typing.Union[EnumHeaderStringArraySchema, list, tuple, ], - 'enum_header_string': typing.Union[EnumHeaderStringSchema, str, ], - }, - total=False -) - - -class RequestHeaderParams(RequestRequiredHeaderParams, RequestOptionalHeaderParams): - pass - - -request_header_enum_header_string_array = api_client.HeaderParameter( - name="enum_header_string_array", - style=api_client.ParameterStyle.SIMPLE, - schema=EnumHeaderStringArraySchema, -) -request_header_enum_header_string = api_client.HeaderParameter( - name="enum_header_string", - style=api_client.ParameterStyle.SIMPLE, - schema=EnumHeaderStringSchema, -) -# body param - - -class SchemaForRequestBodyApplicationXWwwFormUrlencoded( - schemas.DictSchema -): - - - class MetaOapg: - - class properties: - - - class enum_form_string_array( - schemas.ListSchema - ): - - - class MetaOapg: - - - class items( - schemas.EnumBase, - schemas.StrSchema - ): - - - class MetaOapg: - enum_value_to_name = { - ">": "GREATER_THAN", - "$": "DOLLAR", - } - - @schemas.classproperty - def GREATER_THAN(cls): - return cls(">") - - @schemas.classproperty - def DOLLAR(cls): - return cls("$") - - def __new__( - cls, - arg: typing.Union[typing.Tuple[typing.Union[MetaOapg.items, str, ]], typing.List[typing.Union[MetaOapg.items, str, ]]], - _configuration: typing.Optional[schemas.Configuration] = None, - ) -> 'enum_form_string_array': - return super().__new__( - cls, - arg, - _configuration=_configuration, - ) - - def __getitem__(self, i: int) -> MetaOapg.items: - return super().__getitem__(i) - - - class enum_form_string( - schemas.EnumBase, - schemas.StrSchema - ): - - - class MetaOapg: - enum_value_to_name = { - "_abc": "_ABC", - "-efg": "EFG", - "(xyz)": "XYZ", - } - - @schemas.classproperty - def _ABC(cls): - return cls("_abc") - - @schemas.classproperty - def EFG(cls): - return cls("-efg") - - @schemas.classproperty - def XYZ(cls): - return cls("(xyz)") - __annotations__ = { - "enum_form_string_array": enum_form_string_array, - "enum_form_string": enum_form_string, - } - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["enum_form_string_array"]) -> MetaOapg.properties.enum_form_string_array: ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["enum_form_string"]) -> MetaOapg.properties.enum_form_string: ... - - @typing.overload - def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... - - def __getitem__(self, name: typing.Union[typing_extensions.Literal["enum_form_string_array", "enum_form_string", ], str]): - # dict_instance[name] accessor - return super().__getitem__(name) - - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["enum_form_string_array"]) -> typing.Union[MetaOapg.properties.enum_form_string_array, schemas.Unset]: ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["enum_form_string"]) -> typing.Union[MetaOapg.properties.enum_form_string, schemas.Unset]: ... - - @typing.overload - def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... - - def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["enum_form_string_array", "enum_form_string", ], str]): - return super().get_item_oapg(name) - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, ], - enum_form_string_array: typing.Union[MetaOapg.properties.enum_form_string_array, list, tuple, schemas.Unset] = schemas.unset, - enum_form_string: typing.Union[MetaOapg.properties.enum_form_string, str, schemas.Unset] = schemas.unset, - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'SchemaForRequestBodyApplicationXWwwFormUrlencoded': - return super().__new__( - cls, - *args, - enum_form_string_array=enum_form_string_array, - enum_form_string=enum_form_string, - _configuration=_configuration, - **kwargs, - ) - - -request_body_body = api_client.RequestBody( - content={ - 'application/x-www-form-urlencoded': api_client.MediaType( - schema=SchemaForRequestBodyApplicationXWwwFormUrlencoded), - }, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -@dataclass -class ApiResponseFor404(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_404 = api_client.OpenApiResponse( - response_cls=ApiResponseFor404, -) -_status_code_to_response = { - '200': _response_for_200, - '404': _response_for_404, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _enum_parameters_oapg( - self, - content_type: typing_extensions.Literal["application/x-www-form-urlencoded"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - query_params: RequestQueryParams = frozendict.frozendict(), - header_params: RequestHeaderParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _enum_parameters_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - query_params: RequestQueryParams = frozendict.frozendict(), - header_params: RequestHeaderParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _enum_parameters_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - query_params: RequestQueryParams = frozendict.frozendict(), - header_params: RequestHeaderParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _enum_parameters_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - query_params: RequestQueryParams = frozendict.frozendict(), - header_params: RequestHeaderParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _enum_parameters_oapg( - self, - content_type: str = 'application/x-www-form-urlencoded', - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - query_params: RequestQueryParams = frozendict.frozendict(), - header_params: RequestHeaderParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - To test enum parameters - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - self._verify_typed_dict_inputs_oapg(RequestQueryParams, query_params) - self._verify_typed_dict_inputs_oapg(RequestHeaderParams, header_params) - used_path = path.value - - prefix_separator_iterator = None - for parameter in ( - request_query_enum_query_string_array, - request_query_enum_query_string, - request_query_enum_query_integer, - request_query_enum_query_double, - ): - parameter_data = query_params.get(parameter.name, schemas.unset) - if parameter_data is schemas.unset: - continue - if prefix_separator_iterator is None: - prefix_separator_iterator = parameter.get_prefix_separator_iterator() - serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) - for serialized_value in serialized_data.values(): - used_path += serialized_value - - _headers = HTTPHeaderDict() - for parameter in ( - request_header_enum_header_string_array, - request_header_enum_header_string, - ): - parameter_data = header_params.get(parameter.name, schemas.unset) - if parameter_data is schemas.unset: - continue - serialized_data = parameter.serialize(parameter_data) - _headers.extend(serialized_data) - # TODO add cookie handling - - _fields = None - _body = None - if body is not schemas.unset: - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='get'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class EnumParameters(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def enum_parameters( - self, - content_type: typing_extensions.Literal["application/x-www-form-urlencoded"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - query_params: RequestQueryParams = frozendict.frozendict(), - header_params: RequestHeaderParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def enum_parameters( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - query_params: RequestQueryParams = frozendict.frozendict(), - header_params: RequestHeaderParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def enum_parameters( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - query_params: RequestQueryParams = frozendict.frozendict(), - header_params: RequestHeaderParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def enum_parameters( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - query_params: RequestQueryParams = frozendict.frozendict(), - header_params: RequestHeaderParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def enum_parameters( - self, - content_type: str = 'application/x-www-form-urlencoded', - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - query_params: RequestQueryParams = frozendict.frozendict(), - header_params: RequestHeaderParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._enum_parameters_oapg( - body=body, - query_params=query_params, - header_params=header_params, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForget(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def get( - self, - content_type: typing_extensions.Literal["application/x-www-form-urlencoded"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - query_params: RequestQueryParams = frozendict.frozendict(), - header_params: RequestHeaderParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def get( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - query_params: RequestQueryParams = frozendict.frozendict(), - header_params: RequestHeaderParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def get( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - query_params: RequestQueryParams = frozendict.frozendict(), - header_params: RequestHeaderParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - query_params: RequestQueryParams = frozendict.frozendict(), - header_params: RequestHeaderParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get( - self, - content_type: str = 'application/x-www-form-urlencoded', - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - query_params: RequestQueryParams = frozendict.frozendict(), - header_params: RequestHeaderParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._enum_parameters_oapg( - body=body, - query_params=query_params, - header_params=header_params, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake/get.pyi b/samples/openapi3/client/petstore/python/petstore_api/paths/fake/get.pyi deleted file mode 100644 index a2468eb18d8..00000000000 --- a/samples/openapi3/client/petstore/python/petstore_api/paths/fake/get.pyi +++ /dev/null @@ -1,685 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from petstore_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from petstore_api import schemas # noqa: F401 - -# Query params - - -class EnumQueryStringArraySchema( - schemas.ListSchema -): - - - class MetaOapg: - - - class items( - schemas.EnumBase, - schemas.StrSchema - ): - - @schemas.classproperty - def GREATER_THAN(cls): - return cls(">") - - @schemas.classproperty - def DOLLAR(cls): - return cls("$") - - def __new__( - cls, - arg: typing.Union[typing.Tuple[typing.Union[MetaOapg.items, str, ]], typing.List[typing.Union[MetaOapg.items, str, ]]], - _configuration: typing.Optional[schemas.Configuration] = None, - ) -> 'EnumQueryStringArraySchema': - return super().__new__( - cls, - arg, - _configuration=_configuration, - ) - - def __getitem__(self, i: int) -> MetaOapg.items: - return super().__getitem__(i) - - -class EnumQueryStringSchema( - schemas.EnumBase, - schemas.StrSchema -): - - @schemas.classproperty - def _ABC(cls): - return cls("_abc") - - @schemas.classproperty - def EFG(cls): - return cls("-efg") - - @schemas.classproperty - def XYZ(cls): - return cls("(xyz)") - - -class EnumQueryIntegerSchema( - schemas.EnumBase, - schemas.Int32Schema -): - - @schemas.classproperty - def POSITIVE_1(cls): - return cls(1) - - @schemas.classproperty - def NEGATIVE_2(cls): - return cls(-2) - - -class EnumQueryDoubleSchema( - schemas.EnumBase, - schemas.Float64Schema -): - - @schemas.classproperty - def POSITIVE_1_PT_1(cls): - return cls(1.1) - - @schemas.classproperty - def NEGATIVE_1_PT_2(cls): - return cls(-1.2) -RequestRequiredQueryParams = typing_extensions.TypedDict( - 'RequestRequiredQueryParams', - { - } -) -RequestOptionalQueryParams = typing_extensions.TypedDict( - 'RequestOptionalQueryParams', - { - 'enum_query_string_array': typing.Union[EnumQueryStringArraySchema, list, tuple, ], - 'enum_query_string': typing.Union[EnumQueryStringSchema, str, ], - 'enum_query_integer': typing.Union[EnumQueryIntegerSchema, decimal.Decimal, int, ], - 'enum_query_double': typing.Union[EnumQueryDoubleSchema, decimal.Decimal, int, float, ], - }, - total=False -) - - -class RequestQueryParams(RequestRequiredQueryParams, RequestOptionalQueryParams): - pass - - -request_query_enum_query_string_array = api_client.QueryParameter( - name="enum_query_string_array", - style=api_client.ParameterStyle.FORM, - schema=EnumQueryStringArraySchema, - explode=True, -) -request_query_enum_query_string = api_client.QueryParameter( - name="enum_query_string", - style=api_client.ParameterStyle.FORM, - schema=EnumQueryStringSchema, - explode=True, -) -request_query_enum_query_integer = api_client.QueryParameter( - name="enum_query_integer", - style=api_client.ParameterStyle.FORM, - schema=EnumQueryIntegerSchema, - explode=True, -) -request_query_enum_query_double = api_client.QueryParameter( - name="enum_query_double", - style=api_client.ParameterStyle.FORM, - schema=EnumQueryDoubleSchema, - explode=True, -) -# Header params - - -class EnumHeaderStringArraySchema( - schemas.ListSchema -): - - - class MetaOapg: - - - class items( - schemas.EnumBase, - schemas.StrSchema - ): - - @schemas.classproperty - def GREATER_THAN(cls): - return cls(">") - - @schemas.classproperty - def DOLLAR(cls): - return cls("$") - - def __new__( - cls, - arg: typing.Union[typing.Tuple[typing.Union[MetaOapg.items, str, ]], typing.List[typing.Union[MetaOapg.items, str, ]]], - _configuration: typing.Optional[schemas.Configuration] = None, - ) -> 'EnumHeaderStringArraySchema': - return super().__new__( - cls, - arg, - _configuration=_configuration, - ) - - def __getitem__(self, i: int) -> MetaOapg.items: - return super().__getitem__(i) - - -class EnumHeaderStringSchema( - schemas.EnumBase, - schemas.StrSchema -): - - @schemas.classproperty - def _ABC(cls): - return cls("_abc") - - @schemas.classproperty - def EFG(cls): - return cls("-efg") - - @schemas.classproperty - def XYZ(cls): - return cls("(xyz)") -RequestRequiredHeaderParams = typing_extensions.TypedDict( - 'RequestRequiredHeaderParams', - { - } -) -RequestOptionalHeaderParams = typing_extensions.TypedDict( - 'RequestOptionalHeaderParams', - { - 'enum_header_string_array': typing.Union[EnumHeaderStringArraySchema, list, tuple, ], - 'enum_header_string': typing.Union[EnumHeaderStringSchema, str, ], - }, - total=False -) - - -class RequestHeaderParams(RequestRequiredHeaderParams, RequestOptionalHeaderParams): - pass - - -request_header_enum_header_string_array = api_client.HeaderParameter( - name="enum_header_string_array", - style=api_client.ParameterStyle.SIMPLE, - schema=EnumHeaderStringArraySchema, -) -request_header_enum_header_string = api_client.HeaderParameter( - name="enum_header_string", - style=api_client.ParameterStyle.SIMPLE, - schema=EnumHeaderStringSchema, -) -# body param - - -class SchemaForRequestBodyApplicationXWwwFormUrlencoded( - schemas.DictSchema -): - - - class MetaOapg: - - class properties: - - - class enum_form_string_array( - schemas.ListSchema - ): - - - class MetaOapg: - - - class items( - schemas.EnumBase, - schemas.StrSchema - ): - - @schemas.classproperty - def GREATER_THAN(cls): - return cls(">") - - @schemas.classproperty - def DOLLAR(cls): - return cls("$") - - def __new__( - cls, - arg: typing.Union[typing.Tuple[typing.Union[MetaOapg.items, str, ]], typing.List[typing.Union[MetaOapg.items, str, ]]], - _configuration: typing.Optional[schemas.Configuration] = None, - ) -> 'enum_form_string_array': - return super().__new__( - cls, - arg, - _configuration=_configuration, - ) - - def __getitem__(self, i: int) -> MetaOapg.items: - return super().__getitem__(i) - - - class enum_form_string( - schemas.EnumBase, - schemas.StrSchema - ): - - @schemas.classproperty - def _ABC(cls): - return cls("_abc") - - @schemas.classproperty - def EFG(cls): - return cls("-efg") - - @schemas.classproperty - def XYZ(cls): - return cls("(xyz)") - __annotations__ = { - "enum_form_string_array": enum_form_string_array, - "enum_form_string": enum_form_string, - } - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["enum_form_string_array"]) -> MetaOapg.properties.enum_form_string_array: ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["enum_form_string"]) -> MetaOapg.properties.enum_form_string: ... - - @typing.overload - def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... - - def __getitem__(self, name: typing.Union[typing_extensions.Literal["enum_form_string_array", "enum_form_string", ], str]): - # dict_instance[name] accessor - return super().__getitem__(name) - - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["enum_form_string_array"]) -> typing.Union[MetaOapg.properties.enum_form_string_array, schemas.Unset]: ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["enum_form_string"]) -> typing.Union[MetaOapg.properties.enum_form_string, schemas.Unset]: ... - - @typing.overload - def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... - - def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["enum_form_string_array", "enum_form_string", ], str]): - return super().get_item_oapg(name) - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, ], - enum_form_string_array: typing.Union[MetaOapg.properties.enum_form_string_array, list, tuple, schemas.Unset] = schemas.unset, - enum_form_string: typing.Union[MetaOapg.properties.enum_form_string, str, schemas.Unset] = schemas.unset, - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'SchemaForRequestBodyApplicationXWwwFormUrlencoded': - return super().__new__( - cls, - *args, - enum_form_string_array=enum_form_string_array, - enum_form_string=enum_form_string, - _configuration=_configuration, - **kwargs, - ) - - -request_body_body = api_client.RequestBody( - content={ - 'application/x-www-form-urlencoded': api_client.MediaType( - schema=SchemaForRequestBodyApplicationXWwwFormUrlencoded), - }, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -@dataclass -class ApiResponseFor404(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_404 = api_client.OpenApiResponse( - response_cls=ApiResponseFor404, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _enum_parameters_oapg( - self, - content_type: typing_extensions.Literal["application/x-www-form-urlencoded"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - query_params: RequestQueryParams = frozendict.frozendict(), - header_params: RequestHeaderParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _enum_parameters_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - query_params: RequestQueryParams = frozendict.frozendict(), - header_params: RequestHeaderParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _enum_parameters_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - query_params: RequestQueryParams = frozendict.frozendict(), - header_params: RequestHeaderParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _enum_parameters_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - query_params: RequestQueryParams = frozendict.frozendict(), - header_params: RequestHeaderParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _enum_parameters_oapg( - self, - content_type: str = 'application/x-www-form-urlencoded', - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - query_params: RequestQueryParams = frozendict.frozendict(), - header_params: RequestHeaderParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - To test enum parameters - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - self._verify_typed_dict_inputs_oapg(RequestQueryParams, query_params) - self._verify_typed_dict_inputs_oapg(RequestHeaderParams, header_params) - used_path = path.value - - prefix_separator_iterator = None - for parameter in ( - request_query_enum_query_string_array, - request_query_enum_query_string, - request_query_enum_query_integer, - request_query_enum_query_double, - ): - parameter_data = query_params.get(parameter.name, schemas.unset) - if parameter_data is schemas.unset: - continue - if prefix_separator_iterator is None: - prefix_separator_iterator = parameter.get_prefix_separator_iterator() - serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) - for serialized_value in serialized_data.values(): - used_path += serialized_value - - _headers = HTTPHeaderDict() - for parameter in ( - request_header_enum_header_string_array, - request_header_enum_header_string, - ): - parameter_data = header_params.get(parameter.name, schemas.unset) - if parameter_data is schemas.unset: - continue - serialized_data = parameter.serialize(parameter_data) - _headers.extend(serialized_data) - # TODO add cookie handling - - _fields = None - _body = None - if body is not schemas.unset: - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='get'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class EnumParameters(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def enum_parameters( - self, - content_type: typing_extensions.Literal["application/x-www-form-urlencoded"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - query_params: RequestQueryParams = frozendict.frozendict(), - header_params: RequestHeaderParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def enum_parameters( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - query_params: RequestQueryParams = frozendict.frozendict(), - header_params: RequestHeaderParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def enum_parameters( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - query_params: RequestQueryParams = frozendict.frozendict(), - header_params: RequestHeaderParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def enum_parameters( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - query_params: RequestQueryParams = frozendict.frozendict(), - header_params: RequestHeaderParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def enum_parameters( - self, - content_type: str = 'application/x-www-form-urlencoded', - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - query_params: RequestQueryParams = frozendict.frozendict(), - header_params: RequestHeaderParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._enum_parameters_oapg( - body=body, - query_params=query_params, - header_params=header_params, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForget(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def get( - self, - content_type: typing_extensions.Literal["application/x-www-form-urlencoded"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - query_params: RequestQueryParams = frozendict.frozendict(), - header_params: RequestHeaderParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def get( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - query_params: RequestQueryParams = frozendict.frozendict(), - header_params: RequestHeaderParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def get( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - query_params: RequestQueryParams = frozendict.frozendict(), - header_params: RequestHeaderParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - query_params: RequestQueryParams = frozendict.frozendict(), - header_params: RequestHeaderParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get( - self, - content_type: str = 'application/x-www-form-urlencoded', - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - query_params: RequestQueryParams = frozendict.frozendict(), - header_params: RequestHeaderParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._enum_parameters_oapg( - body=body, - query_params=query_params, - header_params=header_params, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake/get/__init__.py b/samples/openapi3/client/petstore/python/petstore_api/paths/fake/get/__init__.py new file mode 100644 index 00000000000..30c37126489 --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/fake/get/__init__.py @@ -0,0 +1,738 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 +from . import response_for_404 + + + +class RequestQueryParameters: + class Schemas: + + + class enum_query_string_array( + schemas.ListSchema + ): + + + class MetaOapg: + + + class items( + schemas.EnumBase, + schemas.StrSchema + ): + + + class MetaOapg: + enum_value_to_name = { + ">": "GREATER_THAN", + "$": "DOLLAR", + } + + @schemas.classproperty + def GREATER_THAN(cls): + return cls(">") + + @schemas.classproperty + def DOLLAR(cls): + return cls("$") + + def __new__( + cls, + arg: typing.Union[typing.Tuple[typing.Union[MetaOapg.items, str, ]], typing.List[typing.Union[MetaOapg.items, str, ]]], + _configuration: typing.Optional[schemas.Configuration] = None, + ) -> 'enum_query_string_array': + return super().__new__( + cls, + arg, + _configuration=_configuration, + ) + + def __getitem__(self, i: int) -> MetaOapg.items: + return super().__getitem__(i) + + + class enum_query_string( + schemas.EnumBase, + schemas.StrSchema + ): + + + class MetaOapg: + enum_value_to_name = { + "_abc": "_ABC", + "-efg": "EFG", + "(xyz)": "XYZ", + } + + @schemas.classproperty + def _ABC(cls): + return cls("_abc") + + @schemas.classproperty + def EFG(cls): + return cls("-efg") + + @schemas.classproperty + def XYZ(cls): + return cls("(xyz)") + + + class enum_query_integer( + schemas.EnumBase, + schemas.Int32Schema + ): + + + class MetaOapg: + format = 'int32' + enum_value_to_name = { + 1: "POSITIVE_1", + -2: "NEGATIVE_2", + } + + @schemas.classproperty + def POSITIVE_1(cls): + return cls(1) + + @schemas.classproperty + def NEGATIVE_2(cls): + return cls(-2) + + + class enum_query_double( + schemas.EnumBase, + schemas.Float64Schema + ): + + + class MetaOapg: + format = 'double' + enum_value_to_name = { + 1.1: "POSITIVE_1_PT_1", + -1.2: "NEGATIVE_1_PT_2", + } + + @schemas.classproperty + def POSITIVE_1_PT_1(cls): + return cls(1.1) + + @schemas.classproperty + def NEGATIVE_1_PT_2(cls): + return cls(-1.2) + + + RequiredParams = typing_extensions.TypedDict( + 'RequiredParams', + { + } + ) + OptionalParams = typing_extensions.TypedDict( + 'OptionalParams', + { + 'enum_query_string_array': typing.Union[Schemas.enum_query_string_array, list, tuple, ], + 'enum_query_string': typing.Union[Schemas.enum_query_string, str, ], + 'enum_query_integer': typing.Union[Schemas.enum_query_integer, decimal.Decimal, int, ], + 'enum_query_double': typing.Union[Schemas.enum_query_double, decimal.Decimal, int, float, ], + }, + total=False + ) + + + class Params(RequiredParams, OptionalParams): + pass + + + parameters = [ + api_client.QueryParameter( + name="enum_query_string_array", + style=api_client.ParameterStyle.FORM, + schema=Schemas.enum_query_string_array, + explode=True, + ), + api_client.QueryParameter( + name="enum_query_string", + style=api_client.ParameterStyle.FORM, + schema=Schemas.enum_query_string, + explode=True, + ), + api_client.QueryParameter( + name="enum_query_integer", + style=api_client.ParameterStyle.FORM, + schema=Schemas.enum_query_integer, + explode=True, + ), + api_client.QueryParameter( + name="enum_query_double", + style=api_client.ParameterStyle.FORM, + schema=Schemas.enum_query_double, + explode=True, + ), + ] + +class RequestHeaderParameters: + class Schemas: + + + class enum_header_string_array( + schemas.ListSchema + ): + + + class MetaOapg: + + + class items( + schemas.EnumBase, + schemas.StrSchema + ): + + + class MetaOapg: + enum_value_to_name = { + ">": "GREATER_THAN", + "$": "DOLLAR", + } + + @schemas.classproperty + def GREATER_THAN(cls): + return cls(">") + + @schemas.classproperty + def DOLLAR(cls): + return cls("$") + + def __new__( + cls, + arg: typing.Union[typing.Tuple[typing.Union[MetaOapg.items, str, ]], typing.List[typing.Union[MetaOapg.items, str, ]]], + _configuration: typing.Optional[schemas.Configuration] = None, + ) -> 'enum_header_string_array': + return super().__new__( + cls, + arg, + _configuration=_configuration, + ) + + def __getitem__(self, i: int) -> MetaOapg.items: + return super().__getitem__(i) + + + class enum_header_string( + schemas.EnumBase, + schemas.StrSchema + ): + + + class MetaOapg: + enum_value_to_name = { + "_abc": "_ABC", + "-efg": "EFG", + "(xyz)": "XYZ", + } + + @schemas.classproperty + def _ABC(cls): + return cls("_abc") + + @schemas.classproperty + def EFG(cls): + return cls("-efg") + + @schemas.classproperty + def XYZ(cls): + return cls("(xyz)") + + + RequiredParams = typing_extensions.TypedDict( + 'RequiredParams', + { + } + ) + OptionalParams = typing_extensions.TypedDict( + 'OptionalParams', + { + 'enum_header_string_array': typing.Union[Schemas.enum_header_string_array, list, tuple, ], + 'enum_header_string': typing.Union[Schemas.enum_header_string, str, ], + }, + total=False + ) + + + class Params(RequiredParams, OptionalParams): + pass + + + parameters = [ + api_client.HeaderParameter( + name="enum_header_string_array", + style=api_client.ParameterStyle.SIMPLE, + schema=Schemas.enum_header_string_array, + ), + api_client.HeaderParameter( + name="enum_header_string", + style=api_client.ParameterStyle.SIMPLE, + schema=Schemas.enum_header_string, + ), + ] + +class RequestBody: + class Schemas: + + + class application_x_www_form_urlencoded( + schemas.DictSchema + ): + + + class MetaOapg: + + class properties: + + + class enum_form_string_array( + schemas.ListSchema + ): + + + class MetaOapg: + + + class items( + schemas.EnumBase, + schemas.StrSchema + ): + + + class MetaOapg: + enum_value_to_name = { + ">": "GREATER_THAN", + "$": "DOLLAR", + } + + @schemas.classproperty + def GREATER_THAN(cls): + return cls(">") + + @schemas.classproperty + def DOLLAR(cls): + return cls("$") + + def __new__( + cls, + arg: typing.Union[typing.Tuple[typing.Union[MetaOapg.items, str, ]], typing.List[typing.Union[MetaOapg.items, str, ]]], + _configuration: typing.Optional[schemas.Configuration] = None, + ) -> 'enum_form_string_array': + return super().__new__( + cls, + arg, + _configuration=_configuration, + ) + + def __getitem__(self, i: int) -> MetaOapg.items: + return super().__getitem__(i) + + + class enum_form_string( + schemas.EnumBase, + schemas.StrSchema + ): + + + class MetaOapg: + enum_value_to_name = { + "_abc": "_ABC", + "-efg": "EFG", + "(xyz)": "XYZ", + } + + @schemas.classproperty + def _ABC(cls): + return cls("_abc") + + @schemas.classproperty + def EFG(cls): + return cls("-efg") + + @schemas.classproperty + def XYZ(cls): + return cls("(xyz)") + __annotations__ = { + "enum_form_string_array": enum_form_string_array, + "enum_form_string": enum_form_string, + } + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["enum_form_string_array"]) -> MetaOapg.properties.enum_form_string_array: ... + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["enum_form_string"]) -> MetaOapg.properties.enum_form_string: ... + + @typing.overload + def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... + + def __getitem__(self, name: typing.Union[typing_extensions.Literal["enum_form_string_array", "enum_form_string", ], str]): + # dict_instance[name] accessor + return super().__getitem__(name) + + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["enum_form_string_array"]) -> typing.Union[MetaOapg.properties.enum_form_string_array, schemas.Unset]: ... + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["enum_form_string"]) -> typing.Union[MetaOapg.properties.enum_form_string, schemas.Unset]: ... + + @typing.overload + def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... + + def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["enum_form_string_array", "enum_form_string", ], str]): + return super().get_item_oapg(name) + + + def __new__( + cls, + *args: typing.Union[dict, frozendict.frozendict, ], + enum_form_string_array: typing.Union[MetaOapg.properties.enum_form_string_array, list, tuple, schemas.Unset] = schemas.unset, + enum_form_string: typing.Union[MetaOapg.properties.enum_form_string, str, schemas.Unset] = schemas.unset, + _configuration: typing.Optional[schemas.Configuration] = None, + **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], + ) -> 'application_x_www_form_urlencoded': + return super().__new__( + cls, + *args, + enum_form_string_array=enum_form_string_array, + enum_form_string=enum_form_string, + _configuration=_configuration, + **kwargs, + ) + + parameter = api_client.RequestBody( + content={ + 'application/x-www-form-urlencoded': api_client.MediaType( + schema=Schemas.application_x_www_form_urlencoded + ), + }, + ) + +_status_code_to_response = { + '200': response_for_200.response, + '404': response_for_404.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _enum_parameters_oapg( + self, + content_type: typing_extensions.Literal["application/x-www-form-urlencoded"] = ..., + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + header_params: RequestHeaderParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _enum_parameters_oapg( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + header_params: RequestHeaderParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _enum_parameters_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + header_params: RequestHeaderParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _enum_parameters_oapg( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + header_params: RequestHeaderParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _enum_parameters_oapg( + self, + content_type: str = 'application/x-www-form-urlencoded', + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + header_params: RequestHeaderParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + To test enum parameters + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + self._verify_typed_dict_inputs_oapg(RequestQueryParameters.Params, query_params) + self._verify_typed_dict_inputs_oapg(RequestHeaderParameters.Params, header_params) + used_path = path.value + + prefix_separator_iterator = None + for parameter in RequestQueryParameters.parameters: + parameter_data = query_params.get(parameter.name, schemas.unset) + if parameter_data is schemas.unset: + continue + if prefix_separator_iterator is None: + prefix_separator_iterator = parameter.get_prefix_separator_iterator() + serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) + for serialized_value in serialized_data.values(): + used_path += serialized_value + + _headers = HTTPHeaderDict() + for parameter in RequestHeaderParameters.parameters: + parameter_data = header_params.get(parameter.name, schemas.unset) + if parameter_data is schemas.unset: + continue + serialized_data = parameter.serialize(parameter_data) + _headers.extend(serialized_data) + # TODO add cookie handling + + _fields = None + _body = None + if body is not schemas.unset: + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='get'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class EnumParameters(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def enum_parameters( + self, + content_type: typing_extensions.Literal["application/x-www-form-urlencoded"] = ..., + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + header_params: RequestHeaderParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def enum_parameters( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + header_params: RequestHeaderParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def enum_parameters( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + header_params: RequestHeaderParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def enum_parameters( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + header_params: RequestHeaderParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def enum_parameters( + self, + content_type: str = 'application/x-www-form-urlencoded', + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + header_params: RequestHeaderParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._enum_parameters_oapg( + body=body, + query_params=query_params, + header_params=header_params, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForget(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def get( + self, + content_type: typing_extensions.Literal["application/x-www-form-urlencoded"] = ..., + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + header_params: RequestHeaderParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def get( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + header_params: RequestHeaderParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def get( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + header_params: RequestHeaderParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def get( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + header_params: RequestHeaderParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def get( + self, + content_type: str = 'application/x-www-form-urlencoded', + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + header_params: RequestHeaderParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._enum_parameters_oapg( + body=body, + query_params=query_params, + header_params=header_params, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake/get/__init__.pyi b/samples/openapi3/client/petstore/python/petstore_api/paths/fake/get/__init__.pyi new file mode 100644 index 00000000000..868e35ada86 --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/fake/get/__init__.pyi @@ -0,0 +1,671 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from . import response_for_200 +from . import response_for_404 + + + +class RequestQueryParameters: + class Schemas: + + + class enum_query_string_array( + schemas.ListSchema + ): + + + class MetaOapg: + + + class items( + schemas.EnumBase, + schemas.StrSchema + ): + + @schemas.classproperty + def GREATER_THAN(cls): + return cls(">") + + @schemas.classproperty + def DOLLAR(cls): + return cls("$") + + def __new__( + cls, + arg: typing.Union[typing.Tuple[typing.Union[MetaOapg.items, str, ]], typing.List[typing.Union[MetaOapg.items, str, ]]], + _configuration: typing.Optional[schemas.Configuration] = None, + ) -> 'enum_query_string_array': + return super().__new__( + cls, + arg, + _configuration=_configuration, + ) + + def __getitem__(self, i: int) -> MetaOapg.items: + return super().__getitem__(i) + + + class enum_query_string( + schemas.EnumBase, + schemas.StrSchema + ): + + @schemas.classproperty + def _ABC(cls): + return cls("_abc") + + @schemas.classproperty + def EFG(cls): + return cls("-efg") + + @schemas.classproperty + def XYZ(cls): + return cls("(xyz)") + + + class enum_query_integer( + schemas.EnumBase, + schemas.Int32Schema + ): + + @schemas.classproperty + def POSITIVE_1(cls): + return cls(1) + + @schemas.classproperty + def NEGATIVE_2(cls): + return cls(-2) + + + class enum_query_double( + schemas.EnumBase, + schemas.Float64Schema + ): + + @schemas.classproperty + def POSITIVE_1_PT_1(cls): + return cls(1.1) + + @schemas.classproperty + def NEGATIVE_1_PT_2(cls): + return cls(-1.2) + + + RequiredParams = typing_extensions.TypedDict( + 'RequiredParams', + { + } + ) + OptionalParams = typing_extensions.TypedDict( + 'OptionalParams', + { + 'enum_query_string_array': typing.Union[Schemas.enum_query_string_array, list, tuple, ], + 'enum_query_string': typing.Union[Schemas.enum_query_string, str, ], + 'enum_query_integer': typing.Union[Schemas.enum_query_integer, decimal.Decimal, int, ], + 'enum_query_double': typing.Union[Schemas.enum_query_double, decimal.Decimal, int, float, ], + }, + total=False + ) + + + class Params(RequiredParams, OptionalParams): + pass + + + parameters = [ + api_client.QueryParameter( + name="enum_query_string_array", + style=api_client.ParameterStyle.FORM, + schema=Schemas.enum_query_string_array, + explode=True, + ), + api_client.QueryParameter( + name="enum_query_string", + style=api_client.ParameterStyle.FORM, + schema=Schemas.enum_query_string, + explode=True, + ), + api_client.QueryParameter( + name="enum_query_integer", + style=api_client.ParameterStyle.FORM, + schema=Schemas.enum_query_integer, + explode=True, + ), + api_client.QueryParameter( + name="enum_query_double", + style=api_client.ParameterStyle.FORM, + schema=Schemas.enum_query_double, + explode=True, + ), + ] + +class RequestHeaderParameters: + class Schemas: + + + class enum_header_string_array( + schemas.ListSchema + ): + + + class MetaOapg: + + + class items( + schemas.EnumBase, + schemas.StrSchema + ): + + @schemas.classproperty + def GREATER_THAN(cls): + return cls(">") + + @schemas.classproperty + def DOLLAR(cls): + return cls("$") + + def __new__( + cls, + arg: typing.Union[typing.Tuple[typing.Union[MetaOapg.items, str, ]], typing.List[typing.Union[MetaOapg.items, str, ]]], + _configuration: typing.Optional[schemas.Configuration] = None, + ) -> 'enum_header_string_array': + return super().__new__( + cls, + arg, + _configuration=_configuration, + ) + + def __getitem__(self, i: int) -> MetaOapg.items: + return super().__getitem__(i) + + + class enum_header_string( + schemas.EnumBase, + schemas.StrSchema + ): + + @schemas.classproperty + def _ABC(cls): + return cls("_abc") + + @schemas.classproperty + def EFG(cls): + return cls("-efg") + + @schemas.classproperty + def XYZ(cls): + return cls("(xyz)") + + + RequiredParams = typing_extensions.TypedDict( + 'RequiredParams', + { + } + ) + OptionalParams = typing_extensions.TypedDict( + 'OptionalParams', + { + 'enum_header_string_array': typing.Union[Schemas.enum_header_string_array, list, tuple, ], + 'enum_header_string': typing.Union[Schemas.enum_header_string, str, ], + }, + total=False + ) + + + class Params(RequiredParams, OptionalParams): + pass + + + parameters = [ + api_client.HeaderParameter( + name="enum_header_string_array", + style=api_client.ParameterStyle.SIMPLE, + schema=Schemas.enum_header_string_array, + ), + api_client.HeaderParameter( + name="enum_header_string", + style=api_client.ParameterStyle.SIMPLE, + schema=Schemas.enum_header_string, + ), + ] + +class RequestBody: + class Schemas: + + + class application_x_www_form_urlencoded( + schemas.DictSchema + ): + + + class MetaOapg: + + class properties: + + + class enum_form_string_array( + schemas.ListSchema + ): + + + class MetaOapg: + + + class items( + schemas.EnumBase, + schemas.StrSchema + ): + + @schemas.classproperty + def GREATER_THAN(cls): + return cls(">") + + @schemas.classproperty + def DOLLAR(cls): + return cls("$") + + def __new__( + cls, + arg: typing.Union[typing.Tuple[typing.Union[MetaOapg.items, str, ]], typing.List[typing.Union[MetaOapg.items, str, ]]], + _configuration: typing.Optional[schemas.Configuration] = None, + ) -> 'enum_form_string_array': + return super().__new__( + cls, + arg, + _configuration=_configuration, + ) + + def __getitem__(self, i: int) -> MetaOapg.items: + return super().__getitem__(i) + + + class enum_form_string( + schemas.EnumBase, + schemas.StrSchema + ): + + @schemas.classproperty + def _ABC(cls): + return cls("_abc") + + @schemas.classproperty + def EFG(cls): + return cls("-efg") + + @schemas.classproperty + def XYZ(cls): + return cls("(xyz)") + __annotations__ = { + "enum_form_string_array": enum_form_string_array, + "enum_form_string": enum_form_string, + } + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["enum_form_string_array"]) -> MetaOapg.properties.enum_form_string_array: ... + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["enum_form_string"]) -> MetaOapg.properties.enum_form_string: ... + + @typing.overload + def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... + + def __getitem__(self, name: typing.Union[typing_extensions.Literal["enum_form_string_array", "enum_form_string", ], str]): + # dict_instance[name] accessor + return super().__getitem__(name) + + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["enum_form_string_array"]) -> typing.Union[MetaOapg.properties.enum_form_string_array, schemas.Unset]: ... + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["enum_form_string"]) -> typing.Union[MetaOapg.properties.enum_form_string, schemas.Unset]: ... + + @typing.overload + def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... + + def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["enum_form_string_array", "enum_form_string", ], str]): + return super().get_item_oapg(name) + + + def __new__( + cls, + *args: typing.Union[dict, frozendict.frozendict, ], + enum_form_string_array: typing.Union[MetaOapg.properties.enum_form_string_array, list, tuple, schemas.Unset] = schemas.unset, + enum_form_string: typing.Union[MetaOapg.properties.enum_form_string, str, schemas.Unset] = schemas.unset, + _configuration: typing.Optional[schemas.Configuration] = None, + **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], + ) -> 'application_x_www_form_urlencoded': + return super().__new__( + cls, + *args, + enum_form_string_array=enum_form_string_array, + enum_form_string=enum_form_string, + _configuration=_configuration, + **kwargs, + ) + + parameter = api_client.RequestBody( + content={ + 'application/x-www-form-urlencoded': api_client.MediaType( + schema=Schemas.application_x_www_form_urlencoded + ), + }, + ) + + +class BaseApi(api_client.Api): + @typing.overload + def _enum_parameters_oapg( + self, + content_type: typing_extensions.Literal["application/x-www-form-urlencoded"] = ..., + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + header_params: RequestHeaderParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _enum_parameters_oapg( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + header_params: RequestHeaderParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _enum_parameters_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + header_params: RequestHeaderParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _enum_parameters_oapg( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + header_params: RequestHeaderParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _enum_parameters_oapg( + self, + content_type: str = 'application/x-www-form-urlencoded', + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + header_params: RequestHeaderParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + To test enum parameters + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + self._verify_typed_dict_inputs_oapg(RequestQueryParameters.Params, query_params) + self._verify_typed_dict_inputs_oapg(RequestHeaderParameters.Params, header_params) + used_path = path.value + + prefix_separator_iterator = None + for parameter in RequestQueryParameters.parameters: + parameter_data = query_params.get(parameter.name, schemas.unset) + if parameter_data is schemas.unset: + continue + if prefix_separator_iterator is None: + prefix_separator_iterator = parameter.get_prefix_separator_iterator() + serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) + for serialized_value in serialized_data.values(): + used_path += serialized_value + + _headers = HTTPHeaderDict() + for parameter in RequestHeaderParameters.parameters: + parameter_data = header_params.get(parameter.name, schemas.unset) + if parameter_data is schemas.unset: + continue + serialized_data = parameter.serialize(parameter_data) + _headers.extend(serialized_data) + # TODO add cookie handling + + _fields = None + _body = None + if body is not schemas.unset: + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='get'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class EnumParameters(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def enum_parameters( + self, + content_type: typing_extensions.Literal["application/x-www-form-urlencoded"] = ..., + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + header_params: RequestHeaderParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def enum_parameters( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + header_params: RequestHeaderParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def enum_parameters( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + header_params: RequestHeaderParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def enum_parameters( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + header_params: RequestHeaderParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def enum_parameters( + self, + content_type: str = 'application/x-www-form-urlencoded', + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + header_params: RequestHeaderParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._enum_parameters_oapg( + body=body, + query_params=query_params, + header_params=header_params, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForget(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def get( + self, + content_type: typing_extensions.Literal["application/x-www-form-urlencoded"] = ..., + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + header_params: RequestHeaderParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def get( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + header_params: RequestHeaderParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def get( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + header_params: RequestHeaderParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def get( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + header_params: RequestHeaderParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def get( + self, + content_type: str = 'application/x-www-form-urlencoded', + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + header_params: RequestHeaderParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._enum_parameters_oapg( + body=body, + query_params=query_params, + header_params=header_params, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake/get/response_for_200.py b/samples/openapi3/client/petstore/python/petstore_api/paths/fake/get/response_for_200.py new file mode 100644 index 00000000000..7ec95a8627a --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/fake/get/response_for_200.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from petstore_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake/get/response_for_404.py b/samples/openapi3/client/petstore/python/petstore_api/paths/fake/get/response_for_404.py new file mode 100644 index 00000000000..7ec95a8627a --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/fake/get/response_for_404.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from petstore_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake/patch.py b/samples/openapi3/client/petstore/python/petstore_api/paths/fake/patch.py deleted file mode 100644 index 5a5927a2b09..00000000000 --- a/samples/openapi3/client/petstore/python/petstore_api/paths/fake/patch.py +++ /dev/null @@ -1,329 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from petstore_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from petstore_api import schemas # noqa: F401 - -from petstore_api.model.client import Client - -from . import path - -# body param -SchemaForRequestBodyApplicationJson = Client - - -request_body_client = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) -SchemaFor200ResponseBodyApplicationJson = Client - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_status_code_to_response = { - '200': _response_for_200, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _client_model_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _client_model_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _client_model_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _client_model_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _client_model_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - To test \"client\" model - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_client.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='patch'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class ClientModel(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def client_model( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def client_model( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def client_model( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def client_model( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def client_model( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._client_model_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpatch(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def patch( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def patch( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def patch( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def patch( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def patch( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._client_model_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake/patch.pyi b/samples/openapi3/client/petstore/python/petstore_api/paths/fake/patch.pyi deleted file mode 100644 index 1cd6c453775..00000000000 --- a/samples/openapi3/client/petstore/python/petstore_api/paths/fake/patch.pyi +++ /dev/null @@ -1,324 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from petstore_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from petstore_api import schemas # noqa: F401 - -from petstore_api.model.client import Client - -# body param -SchemaForRequestBodyApplicationJson = Client - - -request_body_client = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) -SchemaFor200ResponseBodyApplicationJson = Client - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _client_model_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _client_model_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _client_model_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _client_model_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _client_model_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - To test \"client\" model - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_client.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='patch'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class ClientModel(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def client_model( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def client_model( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def client_model( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def client_model( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def client_model( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._client_model_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpatch(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def patch( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def patch( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def patch( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def patch( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def patch( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._client_model_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake/patch/__init__.py b/samples/openapi3/client/petstore/python/petstore_api/paths/fake/patch/__init__.py new file mode 100644 index 00000000000..1d1e09ef194 --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/fake/patch/__init__.py @@ -0,0 +1,315 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from petstore_api.model.client import Client + +from .. import path +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = Client + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _client_model_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _client_model_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _client_model_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _client_model_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _client_model_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + To test \"client\" model + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='patch'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class ClientModel(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def client_model( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def client_model( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def client_model( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def client_model( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def client_model( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._client_model_oapg( + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpatch(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def patch( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def patch( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def patch( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def patch( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def patch( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._client_model_oapg( + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake/patch/__init__.pyi b/samples/openapi3/client/petstore/python/petstore_api/paths/fake/patch/__init__.pyi new file mode 100644 index 00000000000..283730f5c31 --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/fake/patch/__init__.pyi @@ -0,0 +1,310 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from petstore_api.model.client import Client + +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = Client + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _client_model_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _client_model_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _client_model_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _client_model_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _client_model_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + To test \"client\" model + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='patch'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class ClientModel(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def client_model( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def client_model( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def client_model( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def client_model( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def client_model( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._client_model_oapg( + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpatch(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def patch( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def patch( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def patch( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def patch( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def patch( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._client_model_oapg( + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake/patch/response_for_200.py b/samples/openapi3/client/petstore/python/petstore_api/paths/fake/patch/response_for_200.py new file mode 100644 index 00000000000..d54e97d5447 --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/fake/patch/response_for_200.py @@ -0,0 +1,43 @@ +import dataclasses +import urllib3 + +from petstore_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from petstore_api.model.client import Client + + +class BodySchemas: + # body schemas + application_json = Client + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake/post.py b/samples/openapi3/client/petstore/python/petstore_api/paths/fake/post.py deleted file mode 100644 index 5bded5d3e06..00000000000 --- a/samples/openapi3/client/petstore/python/petstore_api/paths/fake/post.py +++ /dev/null @@ -1,579 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from petstore_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from petstore_api import schemas # noqa: F401 - -from . import path - -# body param - - -class SchemaForRequestBodyApplicationXWwwFormUrlencoded( - schemas.DictSchema -): - - - class MetaOapg: - required = { - "number", - "pattern_without_delimiter", - "byte", - "double", - } - - class properties: - - - class integer( - schemas.IntSchema - ): - - - class MetaOapg: - inclusive_maximum = 100 - inclusive_minimum = 10 - - - class int32( - schemas.Int32Schema - ): - - - class MetaOapg: - format = 'int32' - inclusive_maximum = 200 - inclusive_minimum = 20 - int64 = schemas.Int64Schema - - - class number( - schemas.NumberSchema - ): - - - class MetaOapg: - inclusive_maximum = 543.2 - inclusive_minimum = 32.1 - - - class _float( - schemas.Float32Schema - ): - - - class MetaOapg: - format = 'float' - inclusive_maximum = 987.6 - - - class double( - schemas.Float64Schema - ): - - - class MetaOapg: - format = 'double' - inclusive_maximum = 123.4 - inclusive_minimum = 67.8 - - - class string( - schemas.StrSchema - ): - - - class MetaOapg: - regex=[{ - 'pattern': r'[a-z]', # noqa: E501 - 'flags': ( - re.IGNORECASE - ) - }] - - - class pattern_without_delimiter( - schemas.StrSchema - ): - - - class MetaOapg: - regex=[{ - 'pattern': r'^[A-Z].*', # noqa: E501 - }] - byte = schemas.StrSchema - binary = schemas.BinarySchema - date = schemas.DateSchema - dateTime = schemas.DateTimeSchema - - - class password( - schemas.StrSchema - ): - - - class MetaOapg: - format = 'password' - max_length = 64 - min_length = 10 - callback = schemas.StrSchema - __annotations__ = { - "integer": integer, - "int32": int32, - "int64": int64, - "number": number, - "float": _float, - "double": double, - "string": string, - "pattern_without_delimiter": pattern_without_delimiter, - "byte": byte, - "binary": binary, - "date": date, - "dateTime": dateTime, - "password": password, - "callback": callback, - } - - number: MetaOapg.properties.number - pattern_without_delimiter: MetaOapg.properties.pattern_without_delimiter - byte: MetaOapg.properties.byte - double: MetaOapg.properties.double - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["integer"]) -> MetaOapg.properties.integer: ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["int32"]) -> MetaOapg.properties.int32: ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["int64"]) -> MetaOapg.properties.int64: ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["number"]) -> MetaOapg.properties.number: ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["float"]) -> MetaOapg.properties._float: ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["double"]) -> MetaOapg.properties.double: ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["string"]) -> MetaOapg.properties.string: ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["pattern_without_delimiter"]) -> MetaOapg.properties.pattern_without_delimiter: ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["byte"]) -> MetaOapg.properties.byte: ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["binary"]) -> MetaOapg.properties.binary: ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["date"]) -> MetaOapg.properties.date: ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["dateTime"]) -> MetaOapg.properties.dateTime: ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["password"]) -> MetaOapg.properties.password: ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["callback"]) -> MetaOapg.properties.callback: ... - - @typing.overload - def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... - - def __getitem__(self, name: typing.Union[typing_extensions.Literal["integer", "int32", "int64", "number", "float", "double", "string", "pattern_without_delimiter", "byte", "binary", "date", "dateTime", "password", "callback", ], str]): - # dict_instance[name] accessor - return super().__getitem__(name) - - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["integer"]) -> typing.Union[MetaOapg.properties.integer, schemas.Unset]: ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["int32"]) -> typing.Union[MetaOapg.properties.int32, schemas.Unset]: ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["int64"]) -> typing.Union[MetaOapg.properties.int64, schemas.Unset]: ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["number"]) -> MetaOapg.properties.number: ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["float"]) -> typing.Union[MetaOapg.properties._float, schemas.Unset]: ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["double"]) -> MetaOapg.properties.double: ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["string"]) -> typing.Union[MetaOapg.properties.string, schemas.Unset]: ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["pattern_without_delimiter"]) -> MetaOapg.properties.pattern_without_delimiter: ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["byte"]) -> MetaOapg.properties.byte: ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["binary"]) -> typing.Union[MetaOapg.properties.binary, schemas.Unset]: ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["date"]) -> typing.Union[MetaOapg.properties.date, schemas.Unset]: ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["dateTime"]) -> typing.Union[MetaOapg.properties.dateTime, schemas.Unset]: ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["password"]) -> typing.Union[MetaOapg.properties.password, schemas.Unset]: ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["callback"]) -> typing.Union[MetaOapg.properties.callback, schemas.Unset]: ... - - @typing.overload - def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... - - def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["integer", "int32", "int64", "number", "float", "double", "string", "pattern_without_delimiter", "byte", "binary", "date", "dateTime", "password", "callback", ], str]): - return super().get_item_oapg(name) - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, ], - number: typing.Union[MetaOapg.properties.number, decimal.Decimal, int, float, ], - pattern_without_delimiter: typing.Union[MetaOapg.properties.pattern_without_delimiter, str, ], - byte: typing.Union[MetaOapg.properties.byte, str, ], - double: typing.Union[MetaOapg.properties.double, decimal.Decimal, int, float, ], - integer: typing.Union[MetaOapg.properties.integer, decimal.Decimal, int, schemas.Unset] = schemas.unset, - int32: typing.Union[MetaOapg.properties.int32, decimal.Decimal, int, schemas.Unset] = schemas.unset, - int64: typing.Union[MetaOapg.properties.int64, decimal.Decimal, int, schemas.Unset] = schemas.unset, - string: typing.Union[MetaOapg.properties.string, str, schemas.Unset] = schemas.unset, - binary: typing.Union[MetaOapg.properties.binary, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - date: typing.Union[MetaOapg.properties.date, str, date, schemas.Unset] = schemas.unset, - dateTime: typing.Union[MetaOapg.properties.dateTime, str, datetime, schemas.Unset] = schemas.unset, - password: typing.Union[MetaOapg.properties.password, str, schemas.Unset] = schemas.unset, - callback: typing.Union[MetaOapg.properties.callback, str, schemas.Unset] = schemas.unset, - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'SchemaForRequestBodyApplicationXWwwFormUrlencoded': - return super().__new__( - cls, - *args, - number=number, - pattern_without_delimiter=pattern_without_delimiter, - byte=byte, - double=double, - integer=integer, - int32=int32, - int64=int64, - string=string, - binary=binary, - date=date, - dateTime=dateTime, - password=password, - callback=callback, - _configuration=_configuration, - **kwargs, - ) - - -request_body_body = api_client.RequestBody( - content={ - 'application/x-www-form-urlencoded': api_client.MediaType( - schema=SchemaForRequestBodyApplicationXWwwFormUrlencoded), - }, -) -_auth = [ - 'http_basic_test', -] - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -@dataclass -class ApiResponseFor404(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_404 = api_client.OpenApiResponse( - response_cls=ApiResponseFor404, -) -_status_code_to_response = { - '200': _response_for_200, - '404': _response_for_404, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _endpoint_parameters_oapg( - self, - content_type: typing_extensions.Literal["application/x-www-form-urlencoded"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _endpoint_parameters_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _endpoint_parameters_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _endpoint_parameters_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _endpoint_parameters_oapg( - self, - content_type: str = 'application/x-www-form-urlencoded', - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - _fields = None - _body = None - if body is not schemas.unset: - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class EndpointParameters(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def endpoint_parameters( - self, - content_type: typing_extensions.Literal["application/x-www-form-urlencoded"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def endpoint_parameters( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def endpoint_parameters( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def endpoint_parameters( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def endpoint_parameters( - self, - content_type: str = 'application/x-www-form-urlencoded', - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._endpoint_parameters_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - content_type: typing_extensions.Literal["application/x-www-form-urlencoded"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - content_type: str = 'application/x-www-form-urlencoded', - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._endpoint_parameters_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake/post.pyi b/samples/openapi3/client/petstore/python/petstore_api/paths/fake/post.pyi deleted file mode 100644 index a7dc2f6decd..00000000000 --- a/samples/openapi3/client/petstore/python/petstore_api/paths/fake/post.pyi +++ /dev/null @@ -1,530 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from petstore_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from petstore_api import schemas # noqa: F401 - -# body param - - -class SchemaForRequestBodyApplicationXWwwFormUrlencoded( - schemas.DictSchema -): - - - class MetaOapg: - required = { - "number", - "pattern_without_delimiter", - "byte", - "double", - } - - class properties: - - - class integer( - schemas.IntSchema - ): - pass - - - class int32( - schemas.Int32Schema - ): - pass - int64 = schemas.Int64Schema - - - class number( - schemas.NumberSchema - ): - pass - - - class _float( - schemas.Float32Schema - ): - pass - - - class double( - schemas.Float64Schema - ): - pass - - - class string( - schemas.StrSchema - ): - pass - - - class pattern_without_delimiter( - schemas.StrSchema - ): - pass - byte = schemas.StrSchema - binary = schemas.BinarySchema - date = schemas.DateSchema - dateTime = schemas.DateTimeSchema - - - class password( - schemas.StrSchema - ): - pass - callback = schemas.StrSchema - __annotations__ = { - "integer": integer, - "int32": int32, - "int64": int64, - "number": number, - "float": _float, - "double": double, - "string": string, - "pattern_without_delimiter": pattern_without_delimiter, - "byte": byte, - "binary": binary, - "date": date, - "dateTime": dateTime, - "password": password, - "callback": callback, - } - - number: MetaOapg.properties.number - pattern_without_delimiter: MetaOapg.properties.pattern_without_delimiter - byte: MetaOapg.properties.byte - double: MetaOapg.properties.double - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["integer"]) -> MetaOapg.properties.integer: ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["int32"]) -> MetaOapg.properties.int32: ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["int64"]) -> MetaOapg.properties.int64: ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["number"]) -> MetaOapg.properties.number: ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["float"]) -> MetaOapg.properties._float: ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["double"]) -> MetaOapg.properties.double: ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["string"]) -> MetaOapg.properties.string: ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["pattern_without_delimiter"]) -> MetaOapg.properties.pattern_without_delimiter: ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["byte"]) -> MetaOapg.properties.byte: ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["binary"]) -> MetaOapg.properties.binary: ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["date"]) -> MetaOapg.properties.date: ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["dateTime"]) -> MetaOapg.properties.dateTime: ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["password"]) -> MetaOapg.properties.password: ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["callback"]) -> MetaOapg.properties.callback: ... - - @typing.overload - def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... - - def __getitem__(self, name: typing.Union[typing_extensions.Literal["integer", "int32", "int64", "number", "float", "double", "string", "pattern_without_delimiter", "byte", "binary", "date", "dateTime", "password", "callback", ], str]): - # dict_instance[name] accessor - return super().__getitem__(name) - - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["integer"]) -> typing.Union[MetaOapg.properties.integer, schemas.Unset]: ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["int32"]) -> typing.Union[MetaOapg.properties.int32, schemas.Unset]: ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["int64"]) -> typing.Union[MetaOapg.properties.int64, schemas.Unset]: ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["number"]) -> MetaOapg.properties.number: ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["float"]) -> typing.Union[MetaOapg.properties._float, schemas.Unset]: ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["double"]) -> MetaOapg.properties.double: ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["string"]) -> typing.Union[MetaOapg.properties.string, schemas.Unset]: ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["pattern_without_delimiter"]) -> MetaOapg.properties.pattern_without_delimiter: ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["byte"]) -> MetaOapg.properties.byte: ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["binary"]) -> typing.Union[MetaOapg.properties.binary, schemas.Unset]: ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["date"]) -> typing.Union[MetaOapg.properties.date, schemas.Unset]: ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["dateTime"]) -> typing.Union[MetaOapg.properties.dateTime, schemas.Unset]: ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["password"]) -> typing.Union[MetaOapg.properties.password, schemas.Unset]: ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["callback"]) -> typing.Union[MetaOapg.properties.callback, schemas.Unset]: ... - - @typing.overload - def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... - - def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["integer", "int32", "int64", "number", "float", "double", "string", "pattern_without_delimiter", "byte", "binary", "date", "dateTime", "password", "callback", ], str]): - return super().get_item_oapg(name) - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, ], - number: typing.Union[MetaOapg.properties.number, decimal.Decimal, int, float, ], - pattern_without_delimiter: typing.Union[MetaOapg.properties.pattern_without_delimiter, str, ], - byte: typing.Union[MetaOapg.properties.byte, str, ], - double: typing.Union[MetaOapg.properties.double, decimal.Decimal, int, float, ], - integer: typing.Union[MetaOapg.properties.integer, decimal.Decimal, int, schemas.Unset] = schemas.unset, - int32: typing.Union[MetaOapg.properties.int32, decimal.Decimal, int, schemas.Unset] = schemas.unset, - int64: typing.Union[MetaOapg.properties.int64, decimal.Decimal, int, schemas.Unset] = schemas.unset, - string: typing.Union[MetaOapg.properties.string, str, schemas.Unset] = schemas.unset, - binary: typing.Union[MetaOapg.properties.binary, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - date: typing.Union[MetaOapg.properties.date, str, date, schemas.Unset] = schemas.unset, - dateTime: typing.Union[MetaOapg.properties.dateTime, str, datetime, schemas.Unset] = schemas.unset, - password: typing.Union[MetaOapg.properties.password, str, schemas.Unset] = schemas.unset, - callback: typing.Union[MetaOapg.properties.callback, str, schemas.Unset] = schemas.unset, - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'SchemaForRequestBodyApplicationXWwwFormUrlencoded': - return super().__new__( - cls, - *args, - number=number, - pattern_without_delimiter=pattern_without_delimiter, - byte=byte, - double=double, - integer=integer, - int32=int32, - int64=int64, - string=string, - binary=binary, - date=date, - dateTime=dateTime, - password=password, - callback=callback, - _configuration=_configuration, - **kwargs, - ) - - -request_body_body = api_client.RequestBody( - content={ - 'application/x-www-form-urlencoded': api_client.MediaType( - schema=SchemaForRequestBodyApplicationXWwwFormUrlencoded), - }, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -@dataclass -class ApiResponseFor404(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_404 = api_client.OpenApiResponse( - response_cls=ApiResponseFor404, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _endpoint_parameters_oapg( - self, - content_type: typing_extensions.Literal["application/x-www-form-urlencoded"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _endpoint_parameters_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _endpoint_parameters_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _endpoint_parameters_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _endpoint_parameters_oapg( - self, - content_type: str = 'application/x-www-form-urlencoded', - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - _fields = None - _body = None - if body is not schemas.unset: - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class EndpointParameters(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def endpoint_parameters( - self, - content_type: typing_extensions.Literal["application/x-www-form-urlencoded"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def endpoint_parameters( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def endpoint_parameters( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def endpoint_parameters( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def endpoint_parameters( - self, - content_type: str = 'application/x-www-form-urlencoded', - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._endpoint_parameters_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - content_type: typing_extensions.Literal["application/x-www-form-urlencoded"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - content_type: str = 'application/x-www-form-urlencoded', - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._endpoint_parameters_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake/post/__init__.py b/samples/openapi3/client/petstore/python/petstore_api/paths/fake/post/__init__.py new file mode 100644 index 00000000000..e0009ba7a67 --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/fake/post/__init__.py @@ -0,0 +1,562 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 +from . import response_for_404 + + + +class RequestBody: + class Schemas: + + + class application_x_www_form_urlencoded( + schemas.DictSchema + ): + + + class MetaOapg: + required = { + "number", + "pattern_without_delimiter", + "byte", + "double", + } + + class properties: + + + class integer( + schemas.IntSchema + ): + + + class MetaOapg: + inclusive_maximum = 100 + inclusive_minimum = 10 + + + class int32( + schemas.Int32Schema + ): + + + class MetaOapg: + format = 'int32' + inclusive_maximum = 200 + inclusive_minimum = 20 + int64 = schemas.Int64Schema + + + class number( + schemas.NumberSchema + ): + + + class MetaOapg: + inclusive_maximum = 543.2 + inclusive_minimum = 32.1 + + + class _float( + schemas.Float32Schema + ): + + + class MetaOapg: + format = 'float' + inclusive_maximum = 987.6 + + + class double( + schemas.Float64Schema + ): + + + class MetaOapg: + format = 'double' + inclusive_maximum = 123.4 + inclusive_minimum = 67.8 + + + class string( + schemas.StrSchema + ): + + + class MetaOapg: + regex=[{ + 'pattern': r'[a-z]', # noqa: E501 + 'flags': ( + re.IGNORECASE + ) + }] + + + class pattern_without_delimiter( + schemas.StrSchema + ): + + + class MetaOapg: + regex=[{ + 'pattern': r'^[A-Z].*', # noqa: E501 + }] + byte = schemas.StrSchema + binary = schemas.BinarySchema + date = schemas.DateSchema + dateTime = schemas.DateTimeSchema + + + class password( + schemas.StrSchema + ): + + + class MetaOapg: + format = 'password' + max_length = 64 + min_length = 10 + callback = schemas.StrSchema + __annotations__ = { + "integer": integer, + "int32": int32, + "int64": int64, + "number": number, + "float": _float, + "double": double, + "string": string, + "pattern_without_delimiter": pattern_without_delimiter, + "byte": byte, + "binary": binary, + "date": date, + "dateTime": dateTime, + "password": password, + "callback": callback, + } + + number: MetaOapg.properties.number + pattern_without_delimiter: MetaOapg.properties.pattern_without_delimiter + byte: MetaOapg.properties.byte + double: MetaOapg.properties.double + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["integer"]) -> MetaOapg.properties.integer: ... + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["int32"]) -> MetaOapg.properties.int32: ... + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["int64"]) -> MetaOapg.properties.int64: ... + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["number"]) -> MetaOapg.properties.number: ... + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["float"]) -> MetaOapg.properties._float: ... + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["double"]) -> MetaOapg.properties.double: ... + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["string"]) -> MetaOapg.properties.string: ... + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["pattern_without_delimiter"]) -> MetaOapg.properties.pattern_without_delimiter: ... + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["byte"]) -> MetaOapg.properties.byte: ... + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["binary"]) -> MetaOapg.properties.binary: ... + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["date"]) -> MetaOapg.properties.date: ... + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["dateTime"]) -> MetaOapg.properties.dateTime: ... + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["password"]) -> MetaOapg.properties.password: ... + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["callback"]) -> MetaOapg.properties.callback: ... + + @typing.overload + def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... + + def __getitem__(self, name: typing.Union[typing_extensions.Literal["integer", "int32", "int64", "number", "float", "double", "string", "pattern_without_delimiter", "byte", "binary", "date", "dateTime", "password", "callback", ], str]): + # dict_instance[name] accessor + return super().__getitem__(name) + + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["integer"]) -> typing.Union[MetaOapg.properties.integer, schemas.Unset]: ... + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["int32"]) -> typing.Union[MetaOapg.properties.int32, schemas.Unset]: ... + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["int64"]) -> typing.Union[MetaOapg.properties.int64, schemas.Unset]: ... + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["number"]) -> MetaOapg.properties.number: ... + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["float"]) -> typing.Union[MetaOapg.properties._float, schemas.Unset]: ... + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["double"]) -> MetaOapg.properties.double: ... + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["string"]) -> typing.Union[MetaOapg.properties.string, schemas.Unset]: ... + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["pattern_without_delimiter"]) -> MetaOapg.properties.pattern_without_delimiter: ... + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["byte"]) -> MetaOapg.properties.byte: ... + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["binary"]) -> typing.Union[MetaOapg.properties.binary, schemas.Unset]: ... + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["date"]) -> typing.Union[MetaOapg.properties.date, schemas.Unset]: ... + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["dateTime"]) -> typing.Union[MetaOapg.properties.dateTime, schemas.Unset]: ... + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["password"]) -> typing.Union[MetaOapg.properties.password, schemas.Unset]: ... + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["callback"]) -> typing.Union[MetaOapg.properties.callback, schemas.Unset]: ... + + @typing.overload + def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... + + def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["integer", "int32", "int64", "number", "float", "double", "string", "pattern_without_delimiter", "byte", "binary", "date", "dateTime", "password", "callback", ], str]): + return super().get_item_oapg(name) + + + def __new__( + cls, + *args: typing.Union[dict, frozendict.frozendict, ], + number: typing.Union[MetaOapg.properties.number, decimal.Decimal, int, float, ], + pattern_without_delimiter: typing.Union[MetaOapg.properties.pattern_without_delimiter, str, ], + byte: typing.Union[MetaOapg.properties.byte, str, ], + double: typing.Union[MetaOapg.properties.double, decimal.Decimal, int, float, ], + integer: typing.Union[MetaOapg.properties.integer, decimal.Decimal, int, schemas.Unset] = schemas.unset, + int32: typing.Union[MetaOapg.properties.int32, decimal.Decimal, int, schemas.Unset] = schemas.unset, + int64: typing.Union[MetaOapg.properties.int64, decimal.Decimal, int, schemas.Unset] = schemas.unset, + string: typing.Union[MetaOapg.properties.string, str, schemas.Unset] = schemas.unset, + binary: typing.Union[MetaOapg.properties.binary, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, + date: typing.Union[MetaOapg.properties.date, str, date, schemas.Unset] = schemas.unset, + dateTime: typing.Union[MetaOapg.properties.dateTime, str, datetime, schemas.Unset] = schemas.unset, + password: typing.Union[MetaOapg.properties.password, str, schemas.Unset] = schemas.unset, + callback: typing.Union[MetaOapg.properties.callback, str, schemas.Unset] = schemas.unset, + _configuration: typing.Optional[schemas.Configuration] = None, + **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], + ) -> 'application_x_www_form_urlencoded': + return super().__new__( + cls, + *args, + number=number, + pattern_without_delimiter=pattern_without_delimiter, + byte=byte, + double=double, + integer=integer, + int32=int32, + int64=int64, + string=string, + binary=binary, + date=date, + dateTime=dateTime, + password=password, + callback=callback, + _configuration=_configuration, + **kwargs, + ) + + parameter = api_client.RequestBody( + content={ + 'application/x-www-form-urlencoded': api_client.MediaType( + schema=Schemas.application_x_www_form_urlencoded + ), + }, + ) + +_auth = [ + 'http_basic_test', +] + +_status_code_to_response = { + '200': response_for_200.response, + '404': response_for_404.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _endpoint_parameters_oapg( + self, + content_type: typing_extensions.Literal["application/x-www-form-urlencoded"] = ..., + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _endpoint_parameters_oapg( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _endpoint_parameters_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _endpoint_parameters_oapg( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _endpoint_parameters_oapg( + self, + content_type: str = 'application/x-www-form-urlencoded', + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + _fields = None + _body = None + if body is not schemas.unset: + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + auth_settings=_auth, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class EndpointParameters(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def endpoint_parameters( + self, + content_type: typing_extensions.Literal["application/x-www-form-urlencoded"] = ..., + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def endpoint_parameters( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def endpoint_parameters( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def endpoint_parameters( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def endpoint_parameters( + self, + content_type: str = 'application/x-www-form-urlencoded', + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._endpoint_parameters_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + content_type: typing_extensions.Literal["application/x-www-form-urlencoded"] = ..., + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + content_type: str = 'application/x-www-form-urlencoded', + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._endpoint_parameters_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake/post/__init__.pyi b/samples/openapi3/client/petstore/python/petstore_api/paths/fake/post/__init__.pyi new file mode 100644 index 00000000000..be606039c19 --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/fake/post/__init__.pyi @@ -0,0 +1,512 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from . import response_for_200 +from . import response_for_404 + + + +class RequestBody: + class Schemas: + + + class application_x_www_form_urlencoded( + schemas.DictSchema + ): + + + class MetaOapg: + required = { + "number", + "pattern_without_delimiter", + "byte", + "double", + } + + class properties: + + + class integer( + schemas.IntSchema + ): + pass + + + class int32( + schemas.Int32Schema + ): + pass + int64 = schemas.Int64Schema + + + class number( + schemas.NumberSchema + ): + pass + + + class _float( + schemas.Float32Schema + ): + pass + + + class double( + schemas.Float64Schema + ): + pass + + + class string( + schemas.StrSchema + ): + pass + + + class pattern_without_delimiter( + schemas.StrSchema + ): + pass + byte = schemas.StrSchema + binary = schemas.BinarySchema + date = schemas.DateSchema + dateTime = schemas.DateTimeSchema + + + class password( + schemas.StrSchema + ): + pass + callback = schemas.StrSchema + __annotations__ = { + "integer": integer, + "int32": int32, + "int64": int64, + "number": number, + "float": _float, + "double": double, + "string": string, + "pattern_without_delimiter": pattern_without_delimiter, + "byte": byte, + "binary": binary, + "date": date, + "dateTime": dateTime, + "password": password, + "callback": callback, + } + + number: MetaOapg.properties.number + pattern_without_delimiter: MetaOapg.properties.pattern_without_delimiter + byte: MetaOapg.properties.byte + double: MetaOapg.properties.double + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["integer"]) -> MetaOapg.properties.integer: ... + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["int32"]) -> MetaOapg.properties.int32: ... + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["int64"]) -> MetaOapg.properties.int64: ... + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["number"]) -> MetaOapg.properties.number: ... + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["float"]) -> MetaOapg.properties._float: ... + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["double"]) -> MetaOapg.properties.double: ... + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["string"]) -> MetaOapg.properties.string: ... + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["pattern_without_delimiter"]) -> MetaOapg.properties.pattern_without_delimiter: ... + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["byte"]) -> MetaOapg.properties.byte: ... + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["binary"]) -> MetaOapg.properties.binary: ... + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["date"]) -> MetaOapg.properties.date: ... + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["dateTime"]) -> MetaOapg.properties.dateTime: ... + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["password"]) -> MetaOapg.properties.password: ... + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["callback"]) -> MetaOapg.properties.callback: ... + + @typing.overload + def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... + + def __getitem__(self, name: typing.Union[typing_extensions.Literal["integer", "int32", "int64", "number", "float", "double", "string", "pattern_without_delimiter", "byte", "binary", "date", "dateTime", "password", "callback", ], str]): + # dict_instance[name] accessor + return super().__getitem__(name) + + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["integer"]) -> typing.Union[MetaOapg.properties.integer, schemas.Unset]: ... + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["int32"]) -> typing.Union[MetaOapg.properties.int32, schemas.Unset]: ... + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["int64"]) -> typing.Union[MetaOapg.properties.int64, schemas.Unset]: ... + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["number"]) -> MetaOapg.properties.number: ... + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["float"]) -> typing.Union[MetaOapg.properties._float, schemas.Unset]: ... + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["double"]) -> MetaOapg.properties.double: ... + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["string"]) -> typing.Union[MetaOapg.properties.string, schemas.Unset]: ... + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["pattern_without_delimiter"]) -> MetaOapg.properties.pattern_without_delimiter: ... + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["byte"]) -> MetaOapg.properties.byte: ... + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["binary"]) -> typing.Union[MetaOapg.properties.binary, schemas.Unset]: ... + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["date"]) -> typing.Union[MetaOapg.properties.date, schemas.Unset]: ... + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["dateTime"]) -> typing.Union[MetaOapg.properties.dateTime, schemas.Unset]: ... + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["password"]) -> typing.Union[MetaOapg.properties.password, schemas.Unset]: ... + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["callback"]) -> typing.Union[MetaOapg.properties.callback, schemas.Unset]: ... + + @typing.overload + def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... + + def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["integer", "int32", "int64", "number", "float", "double", "string", "pattern_without_delimiter", "byte", "binary", "date", "dateTime", "password", "callback", ], str]): + return super().get_item_oapg(name) + + + def __new__( + cls, + *args: typing.Union[dict, frozendict.frozendict, ], + number: typing.Union[MetaOapg.properties.number, decimal.Decimal, int, float, ], + pattern_without_delimiter: typing.Union[MetaOapg.properties.pattern_without_delimiter, str, ], + byte: typing.Union[MetaOapg.properties.byte, str, ], + double: typing.Union[MetaOapg.properties.double, decimal.Decimal, int, float, ], + integer: typing.Union[MetaOapg.properties.integer, decimal.Decimal, int, schemas.Unset] = schemas.unset, + int32: typing.Union[MetaOapg.properties.int32, decimal.Decimal, int, schemas.Unset] = schemas.unset, + int64: typing.Union[MetaOapg.properties.int64, decimal.Decimal, int, schemas.Unset] = schemas.unset, + string: typing.Union[MetaOapg.properties.string, str, schemas.Unset] = schemas.unset, + binary: typing.Union[MetaOapg.properties.binary, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, + date: typing.Union[MetaOapg.properties.date, str, date, schemas.Unset] = schemas.unset, + dateTime: typing.Union[MetaOapg.properties.dateTime, str, datetime, schemas.Unset] = schemas.unset, + password: typing.Union[MetaOapg.properties.password, str, schemas.Unset] = schemas.unset, + callback: typing.Union[MetaOapg.properties.callback, str, schemas.Unset] = schemas.unset, + _configuration: typing.Optional[schemas.Configuration] = None, + **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], + ) -> 'application_x_www_form_urlencoded': + return super().__new__( + cls, + *args, + number=number, + pattern_without_delimiter=pattern_without_delimiter, + byte=byte, + double=double, + integer=integer, + int32=int32, + int64=int64, + string=string, + binary=binary, + date=date, + dateTime=dateTime, + password=password, + callback=callback, + _configuration=_configuration, + **kwargs, + ) + + parameter = api_client.RequestBody( + content={ + 'application/x-www-form-urlencoded': api_client.MediaType( + schema=Schemas.application_x_www_form_urlencoded + ), + }, + ) + + +class BaseApi(api_client.Api): + @typing.overload + def _endpoint_parameters_oapg( + self, + content_type: typing_extensions.Literal["application/x-www-form-urlencoded"] = ..., + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _endpoint_parameters_oapg( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _endpoint_parameters_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _endpoint_parameters_oapg( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _endpoint_parameters_oapg( + self, + content_type: str = 'application/x-www-form-urlencoded', + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + _fields = None + _body = None + if body is not schemas.unset: + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + auth_settings=_auth, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class EndpointParameters(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def endpoint_parameters( + self, + content_type: typing_extensions.Literal["application/x-www-form-urlencoded"] = ..., + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def endpoint_parameters( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def endpoint_parameters( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def endpoint_parameters( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def endpoint_parameters( + self, + content_type: str = 'application/x-www-form-urlencoded', + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._endpoint_parameters_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + content_type: typing_extensions.Literal["application/x-www-form-urlencoded"] = ..., + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + content_type: str = 'application/x-www-form-urlencoded', + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._endpoint_parameters_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake/post/response_for_200.py b/samples/openapi3/client/petstore/python/petstore_api/paths/fake/post/response_for_200.py new file mode 100644 index 00000000000..7ec95a8627a --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/fake/post/response_for_200.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from petstore_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake/post/response_for_404.py b/samples/openapi3/client/petstore/python/petstore_api/paths/fake/post/response_for_404.py new file mode 100644 index 00000000000..7ec95a8627a --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/fake/post/response_for_404.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from petstore_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_additional_properties_with_array_of_enums/get.py b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_additional_properties_with_array_of_enums/get.py deleted file mode 100644 index c76f1c57987..00000000000 --- a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_additional_properties_with_array_of_enums/get.py +++ /dev/null @@ -1,326 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from petstore_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from petstore_api import schemas # noqa: F401 - -from petstore_api.model.additional_properties_with_array_of_enums import AdditionalPropertiesWithArrayOfEnums - -from . import path - -# body param -SchemaForRequestBodyApplicationJson = AdditionalPropertiesWithArrayOfEnums - - -request_body_additional_properties_with_array_of_enums = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, -) -SchemaFor200ResponseBodyApplicationJson = AdditionalPropertiesWithArrayOfEnums - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_status_code_to_response = { - '200': _response_for_200, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _additional_properties_with_array_of_enums_oapg( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _additional_properties_with_array_of_enums_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _additional_properties_with_array_of_enums_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _additional_properties_with_array_of_enums_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _additional_properties_with_array_of_enums_oapg( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - Additional Properties with Array of Enums - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - _fields = None - _body = None - if body is not schemas.unset: - serialized_data = request_body_additional_properties_with_array_of_enums.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='get'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class AdditionalPropertiesWithArrayOfEnums(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def additional_properties_with_array_of_enums( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def additional_properties_with_array_of_enums( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def additional_properties_with_array_of_enums( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def additional_properties_with_array_of_enums( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def additional_properties_with_array_of_enums( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._additional_properties_with_array_of_enums_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForget(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def get( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def get( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def get( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._additional_properties_with_array_of_enums_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_additional_properties_with_array_of_enums/get.pyi b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_additional_properties_with_array_of_enums/get.pyi deleted file mode 100644 index 13981bf4750..00000000000 --- a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_additional_properties_with_array_of_enums/get.pyi +++ /dev/null @@ -1,321 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from petstore_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from petstore_api import schemas # noqa: F401 - -from petstore_api.model.additional_properties_with_array_of_enums import AdditionalPropertiesWithArrayOfEnums - -# body param -SchemaForRequestBodyApplicationJson = AdditionalPropertiesWithArrayOfEnums - - -request_body_additional_properties_with_array_of_enums = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, -) -SchemaFor200ResponseBodyApplicationJson = AdditionalPropertiesWithArrayOfEnums - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _additional_properties_with_array_of_enums_oapg( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _additional_properties_with_array_of_enums_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _additional_properties_with_array_of_enums_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _additional_properties_with_array_of_enums_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _additional_properties_with_array_of_enums_oapg( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - Additional Properties with Array of Enums - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - _fields = None - _body = None - if body is not schemas.unset: - serialized_data = request_body_additional_properties_with_array_of_enums.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='get'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class AdditionalPropertiesWithArrayOfEnums(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def additional_properties_with_array_of_enums( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def additional_properties_with_array_of_enums( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def additional_properties_with_array_of_enums( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def additional_properties_with_array_of_enums( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def additional_properties_with_array_of_enums( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._additional_properties_with_array_of_enums_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForget(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def get( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def get( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def get( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._additional_properties_with_array_of_enums_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_additional_properties_with_array_of_enums/get/__init__.py b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_additional_properties_with_array_of_enums/get/__init__.py new file mode 100644 index 00000000000..936e93b4ebc --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_additional_properties_with_array_of_enums/get/__init__.py @@ -0,0 +1,312 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from petstore_api.model.additional_properties_with_array_of_enums import AdditionalPropertiesWithArrayOfEnums + +from .. import path +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = AdditionalPropertiesWithArrayOfEnums + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + ) + +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _additional_properties_with_array_of_enums_oapg( + self, + content_type: typing_extensions.Literal["application/json"] = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _additional_properties_with_array_of_enums_oapg( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _additional_properties_with_array_of_enums_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _additional_properties_with_array_of_enums_oapg( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _additional_properties_with_array_of_enums_oapg( + self, + content_type: str = 'application/json', + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + Additional Properties with Array of Enums + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + _fields = None + _body = None + if body is not schemas.unset: + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='get'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class AdditionalPropertiesWithArrayOfEnums(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def additional_properties_with_array_of_enums( + self, + content_type: typing_extensions.Literal["application/json"] = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def additional_properties_with_array_of_enums( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def additional_properties_with_array_of_enums( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def additional_properties_with_array_of_enums( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def additional_properties_with_array_of_enums( + self, + content_type: str = 'application/json', + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._additional_properties_with_array_of_enums_oapg( + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForget(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def get( + self, + content_type: typing_extensions.Literal["application/json"] = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def get( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def get( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def get( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def get( + self, + content_type: str = 'application/json', + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._additional_properties_with_array_of_enums_oapg( + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_additional_properties_with_array_of_enums/get/__init__.pyi b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_additional_properties_with_array_of_enums/get/__init__.pyi new file mode 100644 index 00000000000..99b50077623 --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_additional_properties_with_array_of_enums/get/__init__.pyi @@ -0,0 +1,307 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from petstore_api.model.additional_properties_with_array_of_enums import AdditionalPropertiesWithArrayOfEnums + +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = AdditionalPropertiesWithArrayOfEnums + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + ) +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _additional_properties_with_array_of_enums_oapg( + self, + content_type: typing_extensions.Literal["application/json"] = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _additional_properties_with_array_of_enums_oapg( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _additional_properties_with_array_of_enums_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _additional_properties_with_array_of_enums_oapg( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _additional_properties_with_array_of_enums_oapg( + self, + content_type: str = 'application/json', + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + Additional Properties with Array of Enums + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + _fields = None + _body = None + if body is not schemas.unset: + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='get'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class AdditionalPropertiesWithArrayOfEnums(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def additional_properties_with_array_of_enums( + self, + content_type: typing_extensions.Literal["application/json"] = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def additional_properties_with_array_of_enums( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def additional_properties_with_array_of_enums( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def additional_properties_with_array_of_enums( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def additional_properties_with_array_of_enums( + self, + content_type: str = 'application/json', + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._additional_properties_with_array_of_enums_oapg( + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForget(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def get( + self, + content_type: typing_extensions.Literal["application/json"] = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def get( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def get( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def get( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def get( + self, + content_type: str = 'application/json', + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._additional_properties_with_array_of_enums_oapg( + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_additional_properties_with_array_of_enums/get/response_for_200.py b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_additional_properties_with_array_of_enums/get/response_for_200.py new file mode 100644 index 00000000000..e7869c57801 --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_additional_properties_with_array_of_enums/get/response_for_200.py @@ -0,0 +1,43 @@ +import dataclasses +import urllib3 + +from petstore_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from petstore_api.model.additional_properties_with_array_of_enums import AdditionalPropertiesWithArrayOfEnums + + +class BodySchemas: + # body schemas + application_json = AdditionalPropertiesWithArrayOfEnums + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_body_with_file_schema/put.py b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_body_with_file_schema/put.py deleted file mode 100644 index 481882c97fa..00000000000 --- a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_body_with_file_schema/put.py +++ /dev/null @@ -1,298 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from petstore_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from petstore_api import schemas # noqa: F401 - -from petstore_api.model.file_schema_test_class import FileSchemaTestClass - -from . import path - -# body param -SchemaForRequestBodyApplicationJson = FileSchemaTestClass - - -request_body_file_schema_test_class = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) -_status_code_to_response = { - '200': _response_for_200, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _body_with_file_schema_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _body_with_file_schema_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _body_with_file_schema_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _body_with_file_schema_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _body_with_file_schema_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_file_schema_test_class.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='put'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class BodyWithFileSchema(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def body_with_file_schema( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def body_with_file_schema( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def body_with_file_schema( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def body_with_file_schema( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def body_with_file_schema( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._body_with_file_schema_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForput(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._body_with_file_schema_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_body_with_file_schema/put.pyi b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_body_with_file_schema/put.pyi deleted file mode 100644 index 7785729eb28..00000000000 --- a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_body_with_file_schema/put.pyi +++ /dev/null @@ -1,293 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from petstore_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from petstore_api import schemas # noqa: F401 - -from petstore_api.model.file_schema_test_class import FileSchemaTestClass - -# body param -SchemaForRequestBodyApplicationJson = FileSchemaTestClass - - -request_body_file_schema_test_class = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _body_with_file_schema_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _body_with_file_schema_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _body_with_file_schema_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _body_with_file_schema_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _body_with_file_schema_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_file_schema_test_class.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='put'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class BodyWithFileSchema(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def body_with_file_schema( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def body_with_file_schema( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def body_with_file_schema( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def body_with_file_schema( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def body_with_file_schema( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._body_with_file_schema_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForput(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._body_with_file_schema_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_body_with_file_schema/put/__init__.py b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_body_with_file_schema/put/__init__.py new file mode 100644 index 00000000000..6c57333639e --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_body_with_file_schema/put/__init__.py @@ -0,0 +1,291 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from petstore_api.model.file_schema_test_class import FileSchemaTestClass + +from .. import path +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = FileSchemaTestClass + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + +_status_code_to_response = { + '200': response_for_200.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _body_with_file_schema_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _body_with_file_schema_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _body_with_file_schema_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _body_with_file_schema_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _body_with_file_schema_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='put'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class BodyWithFileSchema(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def body_with_file_schema( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def body_with_file_schema( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def body_with_file_schema( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def body_with_file_schema( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def body_with_file_schema( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._body_with_file_schema_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForput(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def put( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def put( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def put( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def put( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def put( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._body_with_file_schema_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_body_with_file_schema/put/__init__.pyi b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_body_with_file_schema/put/__init__.pyi new file mode 100644 index 00000000000..a85d7066ed2 --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_body_with_file_schema/put/__init__.pyi @@ -0,0 +1,286 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from petstore_api.model.file_schema_test_class import FileSchemaTestClass + +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = FileSchemaTestClass + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + + +class BaseApi(api_client.Api): + @typing.overload + def _body_with_file_schema_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _body_with_file_schema_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _body_with_file_schema_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _body_with_file_schema_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _body_with_file_schema_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='put'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class BodyWithFileSchema(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def body_with_file_schema( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def body_with_file_schema( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def body_with_file_schema( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def body_with_file_schema( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def body_with_file_schema( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._body_with_file_schema_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForput(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def put( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def put( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def put( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def put( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def put( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._body_with_file_schema_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_body_with_file_schema/put/response_for_200.py b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_body_with_file_schema/put/response_for_200.py new file mode 100644 index 00000000000..7ec95a8627a --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_body_with_file_schema/put/response_for_200.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from petstore_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_body_with_query_params/put.py b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_body_with_query_params/put.py deleted file mode 100644 index 03d8d0b48f6..00000000000 --- a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_body_with_query_params/put.py +++ /dev/null @@ -1,356 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from petstore_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from petstore_api import schemas # noqa: F401 - -from petstore_api.model.user import User - -from . import path - -# Query params -QuerySchema = schemas.StrSchema -RequestRequiredQueryParams = typing_extensions.TypedDict( - 'RequestRequiredQueryParams', - { - 'query': typing.Union[QuerySchema, str, ], - } -) -RequestOptionalQueryParams = typing_extensions.TypedDict( - 'RequestOptionalQueryParams', - { - }, - total=False -) - - -class RequestQueryParams(RequestRequiredQueryParams, RequestOptionalQueryParams): - pass - - -request_query_query = api_client.QueryParameter( - name="query", - style=api_client.ParameterStyle.FORM, - schema=QuerySchema, - required=True, - explode=True, -) -# body param -SchemaForRequestBodyApplicationJson = User - - -request_body_user = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) -_status_code_to_response = { - '200': _response_for_200, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _body_with_query_params_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _body_with_query_params_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _body_with_query_params_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _body_with_query_params_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _body_with_query_params_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - self._verify_typed_dict_inputs_oapg(RequestQueryParams, query_params) - used_path = path.value - - prefix_separator_iterator = None - for parameter in ( - request_query_query, - ): - parameter_data = query_params.get(parameter.name, schemas.unset) - if parameter_data is schemas.unset: - continue - if prefix_separator_iterator is None: - prefix_separator_iterator = parameter.get_prefix_separator_iterator() - serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) - for serialized_value in serialized_data.values(): - used_path += serialized_value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_user.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='put'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class BodyWithQueryParams(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def body_with_query_params( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def body_with_query_params( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def body_with_query_params( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def body_with_query_params( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def body_with_query_params( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._body_with_query_params_oapg( - body=body, - query_params=query_params, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForput(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._body_with_query_params_oapg( - body=body, - query_params=query_params, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_body_with_query_params/put.pyi b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_body_with_query_params/put.pyi deleted file mode 100644 index 6e34838b848..00000000000 --- a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_body_with_query_params/put.pyi +++ /dev/null @@ -1,351 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from petstore_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from petstore_api import schemas # noqa: F401 - -from petstore_api.model.user import User - -# Query params -QuerySchema = schemas.StrSchema -RequestRequiredQueryParams = typing_extensions.TypedDict( - 'RequestRequiredQueryParams', - { - 'query': typing.Union[QuerySchema, str, ], - } -) -RequestOptionalQueryParams = typing_extensions.TypedDict( - 'RequestOptionalQueryParams', - { - }, - total=False -) - - -class RequestQueryParams(RequestRequiredQueryParams, RequestOptionalQueryParams): - pass - - -request_query_query = api_client.QueryParameter( - name="query", - style=api_client.ParameterStyle.FORM, - schema=QuerySchema, - required=True, - explode=True, -) -# body param -SchemaForRequestBodyApplicationJson = User - - -request_body_user = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _body_with_query_params_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _body_with_query_params_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _body_with_query_params_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _body_with_query_params_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _body_with_query_params_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - self._verify_typed_dict_inputs_oapg(RequestQueryParams, query_params) - used_path = path.value - - prefix_separator_iterator = None - for parameter in ( - request_query_query, - ): - parameter_data = query_params.get(parameter.name, schemas.unset) - if parameter_data is schemas.unset: - continue - if prefix_separator_iterator is None: - prefix_separator_iterator = parameter.get_prefix_separator_iterator() - serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) - for serialized_value in serialized_data.values(): - used_path += serialized_value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_user.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='put'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class BodyWithQueryParams(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def body_with_query_params( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def body_with_query_params( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def body_with_query_params( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def body_with_query_params( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def body_with_query_params( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._body_with_query_params_oapg( - body=body, - query_params=query_params, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForput(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._body_with_query_params_oapg( - body=body, - query_params=query_params, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_body_with_query_params/put/__init__.py b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_body_with_query_params/put/__init__.py new file mode 100644 index 00000000000..a835e5f4ae5 --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_body_with_query_params/put/__init__.py @@ -0,0 +1,353 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from petstore_api.model.user import User + +from .. import path +from . import response_for_200 + + + +class RequestQueryParameters: + class Schemas: + query = schemas.StrSchema + + + RequiredParams = typing_extensions.TypedDict( + 'RequiredParams', + { + 'query': typing.Union[Schemas.query, str, ], + } + ) + OptionalParams = typing_extensions.TypedDict( + 'OptionalParams', + { + }, + total=False + ) + + + class Params(RequiredParams, OptionalParams): + pass + + + parameters = [ + api_client.QueryParameter( + name="query", + style=api_client.ParameterStyle.FORM, + schema=Schemas.query, + required=True, + explode=True, + ), + ] + +class RequestBody: + class Schemas: + application_json = User + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + +_status_code_to_response = { + '200': response_for_200.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _body_with_query_params_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _body_with_query_params_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _body_with_query_params_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _body_with_query_params_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _body_with_query_params_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + self._verify_typed_dict_inputs_oapg(RequestQueryParameters.Params, query_params) + used_path = path.value + + prefix_separator_iterator = None + for parameter in RequestQueryParameters.parameters: + parameter_data = query_params.get(parameter.name, schemas.unset) + if parameter_data is schemas.unset: + continue + if prefix_separator_iterator is None: + prefix_separator_iterator = parameter.get_prefix_separator_iterator() + serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) + for serialized_value in serialized_data.values(): + used_path += serialized_value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='put'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class BodyWithQueryParams(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def body_with_query_params( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def body_with_query_params( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def body_with_query_params( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def body_with_query_params( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def body_with_query_params( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._body_with_query_params_oapg( + body=body, + query_params=query_params, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForput(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def put( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def put( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def put( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def put( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def put( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._body_with_query_params_oapg( + body=body, + query_params=query_params, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_body_with_query_params/put/__init__.pyi b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_body_with_query_params/put/__init__.pyi new file mode 100644 index 00000000000..9a02a9d2949 --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_body_with_query_params/put/__init__.pyi @@ -0,0 +1,348 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from petstore_api.model.user import User + +from . import response_for_200 + + + +class RequestQueryParameters: + class Schemas: + query = schemas.StrSchema + + + RequiredParams = typing_extensions.TypedDict( + 'RequiredParams', + { + 'query': typing.Union[Schemas.query, str, ], + } + ) + OptionalParams = typing_extensions.TypedDict( + 'OptionalParams', + { + }, + total=False + ) + + + class Params(RequiredParams, OptionalParams): + pass + + + parameters = [ + api_client.QueryParameter( + name="query", + style=api_client.ParameterStyle.FORM, + schema=Schemas.query, + required=True, + explode=True, + ), + ] + +class RequestBody: + class Schemas: + application_json = User + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + + +class BaseApi(api_client.Api): + @typing.overload + def _body_with_query_params_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _body_with_query_params_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _body_with_query_params_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _body_with_query_params_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _body_with_query_params_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + self._verify_typed_dict_inputs_oapg(RequestQueryParameters.Params, query_params) + used_path = path.value + + prefix_separator_iterator = None + for parameter in RequestQueryParameters.parameters: + parameter_data = query_params.get(parameter.name, schemas.unset) + if parameter_data is schemas.unset: + continue + if prefix_separator_iterator is None: + prefix_separator_iterator = parameter.get_prefix_separator_iterator() + serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) + for serialized_value in serialized_data.values(): + used_path += serialized_value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='put'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class BodyWithQueryParams(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def body_with_query_params( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def body_with_query_params( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def body_with_query_params( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def body_with_query_params( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def body_with_query_params( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._body_with_query_params_oapg( + body=body, + query_params=query_params, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForput(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def put( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def put( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def put( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def put( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def put( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._body_with_query_params_oapg( + body=body, + query_params=query_params, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_body_with_query_params/put/response_for_200.py b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_body_with_query_params/put/response_for_200.py new file mode 100644 index 00000000000..7ec95a8627a --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_body_with_query_params/put/response_for_200.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from petstore_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_case_sensitive_params/put.py b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_case_sensitive_params/put.py deleted file mode 100644 index 766073175bf..00000000000 --- a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_case_sensitive_params/put.py +++ /dev/null @@ -1,276 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 - -from petstore_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from petstore_api import schemas # noqa: F401 - -from . import path - -# Query params -SomeVarSchema = schemas.StrSchema -SomeVarSchema = schemas.StrSchema -SomeVarSchema = schemas.StrSchema -RequestRequiredQueryParams = typing_extensions.TypedDict( - 'RequestRequiredQueryParams', - { - 'someVar': typing.Union[SomeVarSchema, str, ], - 'SomeVar': typing.Union[SomeVarSchema, str, ], - 'some_var': typing.Union[SomeVarSchema, str, ], - } -) -RequestOptionalQueryParams = typing_extensions.TypedDict( - 'RequestOptionalQueryParams', - { - }, - total=False -) - - -class RequestQueryParams(RequestRequiredQueryParams, RequestOptionalQueryParams): - pass - - -request_query_some_var = api_client.QueryParameter( - name="someVar", - style=api_client.ParameterStyle.FORM, - schema=SomeVarSchema, - required=True, - explode=True, -) -request_query_some_var2 = api_client.QueryParameter( - name="SomeVar", - style=api_client.ParameterStyle.FORM, - schema=SomeVarSchema, - required=True, - explode=True, -) -request_query_some_var3 = api_client.QueryParameter( - name="some_var", - style=api_client.ParameterStyle.FORM, - schema=SomeVarSchema, - required=True, - explode=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) -_status_code_to_response = { - '200': _response_for_200, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _case_sensitive_params_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _case_sensitive_params_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _case_sensitive_params_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _case_sensitive_params_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - self._verify_typed_dict_inputs_oapg(RequestQueryParams, query_params) - used_path = path.value - - prefix_separator_iterator = None - for parameter in ( - request_query_some_var, - request_query_some_var2, - request_query_some_var3, - ): - parameter_data = query_params.get(parameter.name, schemas.unset) - if parameter_data is schemas.unset: - continue - if prefix_separator_iterator is None: - prefix_separator_iterator = parameter.get_prefix_separator_iterator() - serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) - for serialized_value in serialized_data.values(): - used_path += serialized_value - # TODO add cookie handling - - response = self.api_client.call_api( - resource_path=used_path, - method='put'.upper(), - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class CaseSensitiveParams(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def case_sensitive_params( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def case_sensitive_params( - self, - skip_deserialization: typing_extensions.Literal[True], - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def case_sensitive_params( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def case_sensitive_params( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._case_sensitive_params_oapg( - query_params=query_params, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForput(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def put( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def put( - self, - skip_deserialization: typing_extensions.Literal[True], - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def put( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def put( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._case_sensitive_params_oapg( - query_params=query_params, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_case_sensitive_params/put.pyi b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_case_sensitive_params/put.pyi deleted file mode 100644 index c5cab839898..00000000000 --- a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_case_sensitive_params/put.pyi +++ /dev/null @@ -1,271 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 - -from petstore_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from petstore_api import schemas # noqa: F401 - -# Query params -SomeVarSchema = schemas.StrSchema -SomeVarSchema = schemas.StrSchema -SomeVarSchema = schemas.StrSchema -RequestRequiredQueryParams = typing_extensions.TypedDict( - 'RequestRequiredQueryParams', - { - 'someVar': typing.Union[SomeVarSchema, str, ], - 'SomeVar': typing.Union[SomeVarSchema, str, ], - 'some_var': typing.Union[SomeVarSchema, str, ], - } -) -RequestOptionalQueryParams = typing_extensions.TypedDict( - 'RequestOptionalQueryParams', - { - }, - total=False -) - - -class RequestQueryParams(RequestRequiredQueryParams, RequestOptionalQueryParams): - pass - - -request_query_some_var = api_client.QueryParameter( - name="someVar", - style=api_client.ParameterStyle.FORM, - schema=SomeVarSchema, - required=True, - explode=True, -) -request_query_some_var2 = api_client.QueryParameter( - name="SomeVar", - style=api_client.ParameterStyle.FORM, - schema=SomeVarSchema, - required=True, - explode=True, -) -request_query_some_var3 = api_client.QueryParameter( - name="some_var", - style=api_client.ParameterStyle.FORM, - schema=SomeVarSchema, - required=True, - explode=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _case_sensitive_params_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _case_sensitive_params_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _case_sensitive_params_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _case_sensitive_params_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - self._verify_typed_dict_inputs_oapg(RequestQueryParams, query_params) - used_path = path.value - - prefix_separator_iterator = None - for parameter in ( - request_query_some_var, - request_query_some_var2, - request_query_some_var3, - ): - parameter_data = query_params.get(parameter.name, schemas.unset) - if parameter_data is schemas.unset: - continue - if prefix_separator_iterator is None: - prefix_separator_iterator = parameter.get_prefix_separator_iterator() - serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) - for serialized_value in serialized_data.values(): - used_path += serialized_value - # TODO add cookie handling - - response = self.api_client.call_api( - resource_path=used_path, - method='put'.upper(), - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class CaseSensitiveParams(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def case_sensitive_params( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def case_sensitive_params( - self, - skip_deserialization: typing_extensions.Literal[True], - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def case_sensitive_params( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def case_sensitive_params( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._case_sensitive_params_oapg( - query_params=query_params, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForput(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def put( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def put( - self, - skip_deserialization: typing_extensions.Literal[True], - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def put( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def put( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._case_sensitive_params_oapg( - query_params=query_params, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_case_sensitive_params/put/__init__.py b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_case_sensitive_params/put/__init__.py new file mode 100644 index 00000000000..66ab8139986 --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_case_sensitive_params/put/__init__.py @@ -0,0 +1,268 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 + + + +class RequestQueryParameters: + class Schemas: + someVar = schemas.StrSchema + SomeVar = schemas.StrSchema + some_var = schemas.StrSchema + + + RequiredParams = typing_extensions.TypedDict( + 'RequiredParams', + { + 'someVar': typing.Union[Schemas.someVar, str, ], + 'SomeVar': typing.Union[Schemas.SomeVar, str, ], + 'some_var': typing.Union[Schemas.some_var, str, ], + } + ) + OptionalParams = typing_extensions.TypedDict( + 'OptionalParams', + { + }, + total=False + ) + + + class Params(RequiredParams, OptionalParams): + pass + + + parameters = [ + api_client.QueryParameter( + name="someVar", + style=api_client.ParameterStyle.FORM, + schema=Schemas.someVar, + required=True, + explode=True, + ), + api_client.QueryParameter( + name="SomeVar", + style=api_client.ParameterStyle.FORM, + schema=Schemas.SomeVar, + required=True, + explode=True, + ), + api_client.QueryParameter( + name="some_var", + style=api_client.ParameterStyle.FORM, + schema=Schemas.some_var, + required=True, + explode=True, + ), + ] +_status_code_to_response = { + '200': response_for_200.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _case_sensitive_params_oapg( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _case_sensitive_params_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _case_sensitive_params_oapg( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _case_sensitive_params_oapg( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + self._verify_typed_dict_inputs_oapg(RequestQueryParameters.Params, query_params) + used_path = path.value + + prefix_separator_iterator = None + for parameter in RequestQueryParameters.parameters: + parameter_data = query_params.get(parameter.name, schemas.unset) + if parameter_data is schemas.unset: + continue + if prefix_separator_iterator is None: + prefix_separator_iterator = parameter.get_prefix_separator_iterator() + serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) + for serialized_value in serialized_data.values(): + used_path += serialized_value + # TODO add cookie handling + + response = self.api_client.call_api( + resource_path=used_path, + method='put'.upper(), + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class CaseSensitiveParams(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def case_sensitive_params( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def case_sensitive_params( + self, + skip_deserialization: typing_extensions.Literal[True], + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def case_sensitive_params( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def case_sensitive_params( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._case_sensitive_params_oapg( + query_params=query_params, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForput(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def put( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def put( + self, + skip_deserialization: typing_extensions.Literal[True], + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def put( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def put( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._case_sensitive_params_oapg( + query_params=query_params, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_case_sensitive_params/put/__init__.pyi b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_case_sensitive_params/put/__init__.pyi new file mode 100644 index 00000000000..6d7cc22808c --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_case_sensitive_params/put/__init__.pyi @@ -0,0 +1,263 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from . import response_for_200 + + + +class RequestQueryParameters: + class Schemas: + someVar = schemas.StrSchema + SomeVar = schemas.StrSchema + some_var = schemas.StrSchema + + + RequiredParams = typing_extensions.TypedDict( + 'RequiredParams', + { + 'someVar': typing.Union[Schemas.someVar, str, ], + 'SomeVar': typing.Union[Schemas.SomeVar, str, ], + 'some_var': typing.Union[Schemas.some_var, str, ], + } + ) + OptionalParams = typing_extensions.TypedDict( + 'OptionalParams', + { + }, + total=False + ) + + + class Params(RequiredParams, OptionalParams): + pass + + + parameters = [ + api_client.QueryParameter( + name="someVar", + style=api_client.ParameterStyle.FORM, + schema=Schemas.someVar, + required=True, + explode=True, + ), + api_client.QueryParameter( + name="SomeVar", + style=api_client.ParameterStyle.FORM, + schema=Schemas.SomeVar, + required=True, + explode=True, + ), + api_client.QueryParameter( + name="some_var", + style=api_client.ParameterStyle.FORM, + schema=Schemas.some_var, + required=True, + explode=True, + ), + ] + +class BaseApi(api_client.Api): + @typing.overload + def _case_sensitive_params_oapg( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _case_sensitive_params_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _case_sensitive_params_oapg( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _case_sensitive_params_oapg( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + self._verify_typed_dict_inputs_oapg(RequestQueryParameters.Params, query_params) + used_path = path.value + + prefix_separator_iterator = None + for parameter in RequestQueryParameters.parameters: + parameter_data = query_params.get(parameter.name, schemas.unset) + if parameter_data is schemas.unset: + continue + if prefix_separator_iterator is None: + prefix_separator_iterator = parameter.get_prefix_separator_iterator() + serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) + for serialized_value in serialized_data.values(): + used_path += serialized_value + # TODO add cookie handling + + response = self.api_client.call_api( + resource_path=used_path, + method='put'.upper(), + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class CaseSensitiveParams(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def case_sensitive_params( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def case_sensitive_params( + self, + skip_deserialization: typing_extensions.Literal[True], + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def case_sensitive_params( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def case_sensitive_params( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._case_sensitive_params_oapg( + query_params=query_params, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForput(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def put( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def put( + self, + skip_deserialization: typing_extensions.Literal[True], + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def put( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def put( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._case_sensitive_params_oapg( + query_params=query_params, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_case_sensitive_params/put/response_for_200.py b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_case_sensitive_params/put/response_for_200.py new file mode 100644 index 00000000000..7ec95a8627a --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_case_sensitive_params/put/response_for_200.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from petstore_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_classname_test/patch.py b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_classname_test/patch.py deleted file mode 100644 index 72a085dbaf5..00000000000 --- a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_classname_test/patch.py +++ /dev/null @@ -1,333 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from petstore_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from petstore_api import schemas # noqa: F401 - -from petstore_api.model.client import Client - -from . import path - -# body param -SchemaForRequestBodyApplicationJson = Client - - -request_body_client = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) -_auth = [ - 'api_key_query', -] -SchemaFor200ResponseBodyApplicationJson = Client - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_status_code_to_response = { - '200': _response_for_200, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _classname_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _classname_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _classname_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _classname_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _classname_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - To test class name in snake case - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_client.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='patch'.upper(), - headers=_headers, - fields=_fields, - body=_body, - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class Classname(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def classname( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def classname( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def classname( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def classname( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def classname( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._classname_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpatch(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def patch( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def patch( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def patch( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def patch( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def patch( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._classname_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_classname_test/patch.pyi b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_classname_test/patch.pyi deleted file mode 100644 index 055301928b9..00000000000 --- a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_classname_test/patch.pyi +++ /dev/null @@ -1,325 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from petstore_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from petstore_api import schemas # noqa: F401 - -from petstore_api.model.client import Client - -# body param -SchemaForRequestBodyApplicationJson = Client - - -request_body_client = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) -SchemaFor200ResponseBodyApplicationJson = Client - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _classname_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _classname_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _classname_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _classname_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _classname_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - To test class name in snake case - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_client.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='patch'.upper(), - headers=_headers, - fields=_fields, - body=_body, - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class Classname(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def classname( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def classname( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def classname( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def classname( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def classname( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._classname_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpatch(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def patch( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def patch( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def patch( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def patch( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def patch( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._classname_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_classname_test/patch/__init__.py b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_classname_test/patch/__init__.py new file mode 100644 index 00000000000..06f74fc57fd --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_classname_test/patch/__init__.py @@ -0,0 +1,320 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from petstore_api.model.client import Client + +from .. import path +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = Client + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + +_auth = [ + 'api_key_query', +] + +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _classname_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _classname_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _classname_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _classname_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _classname_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + To test class name in snake case + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='patch'.upper(), + headers=_headers, + fields=_fields, + body=_body, + auth_settings=_auth, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class Classname(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def classname( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def classname( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def classname( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def classname( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def classname( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._classname_oapg( + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpatch(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def patch( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def patch( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def patch( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def patch( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def patch( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._classname_oapg( + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_classname_test/patch/__init__.pyi b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_classname_test/patch/__init__.pyi new file mode 100644 index 00000000000..80ea9ec0a3a --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_classname_test/patch/__init__.pyi @@ -0,0 +1,311 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from petstore_api.model.client import Client + +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = Client + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _classname_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _classname_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _classname_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _classname_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _classname_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + To test class name in snake case + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='patch'.upper(), + headers=_headers, + fields=_fields, + body=_body, + auth_settings=_auth, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class Classname(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def classname( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def classname( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def classname( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def classname( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def classname( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._classname_oapg( + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpatch(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def patch( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def patch( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def patch( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def patch( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def patch( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._classname_oapg( + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_classname_test/patch/response_for_200.py b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_classname_test/patch/response_for_200.py new file mode 100644 index 00000000000..d54e97d5447 --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_classname_test/patch/response_for_200.py @@ -0,0 +1,43 @@ +import dataclasses +import urllib3 + +from petstore_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from petstore_api.model.client import Client + + +class BodySchemas: + # body schemas + application_json = Client + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_delete_coffee_id/delete.py b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_delete_coffee_id/delete.py deleted file mode 100644 index 4d74087f3bd..00000000000 --- a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_delete_coffee_id/delete.py +++ /dev/null @@ -1,279 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 - -from petstore_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from petstore_api import schemas # noqa: F401 - -from . import path - -# Path params -IdSchema = schemas.StrSchema -RequestRequiredPathParams = typing_extensions.TypedDict( - 'RequestRequiredPathParams', - { - 'id': typing.Union[IdSchema, str, ], - } -) -RequestOptionalPathParams = typing_extensions.TypedDict( - 'RequestOptionalPathParams', - { - }, - total=False -) - - -class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): - pass - - -request_path_id = api_client.PathParameter( - name="id", - style=api_client.ParameterStyle.SIMPLE, - schema=IdSchema, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -@dataclass -class ApiResponseForDefault(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_default = api_client.OpenApiResponse( - response_cls=ApiResponseForDefault, -) -_status_code_to_response = { - '200': _response_for_200, - 'default': _response_for_default, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _delete_coffee_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _delete_coffee_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _delete_coffee_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _delete_coffee_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - Delete coffee - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) - used_path = path.value - - _path_params = {} - for parameter in ( - request_path_id, - ): - parameter_data = path_params.get(parameter.name, schemas.unset) - if parameter_data is schemas.unset: - continue - serialized_data = parameter.serialize(parameter_data) - _path_params.update(serialized_data) - - for k, v in _path_params.items(): - used_path = used_path.replace('{%s}' % k, v) - # TODO add cookie handling - - response = self.api_client.call_api( - resource_path=used_path, - method='delete'.upper(), - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class DeleteCoffee(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def delete_coffee( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def delete_coffee( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def delete_coffee( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def delete_coffee( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._delete_coffee_oapg( - path_params=path_params, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiFordelete(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def delete( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def delete( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def delete( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def delete( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._delete_coffee_oapg( - path_params=path_params, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_delete_coffee_id/delete.pyi b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_delete_coffee_id/delete.pyi deleted file mode 100644 index a63211d2c05..00000000000 --- a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_delete_coffee_id/delete.pyi +++ /dev/null @@ -1,273 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 - -from petstore_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from petstore_api import schemas # noqa: F401 - -# Path params -IdSchema = schemas.StrSchema -RequestRequiredPathParams = typing_extensions.TypedDict( - 'RequestRequiredPathParams', - { - 'id': typing.Union[IdSchema, str, ], - } -) -RequestOptionalPathParams = typing_extensions.TypedDict( - 'RequestOptionalPathParams', - { - }, - total=False -) - - -class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): - pass - - -request_path_id = api_client.PathParameter( - name="id", - style=api_client.ParameterStyle.SIMPLE, - schema=IdSchema, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -@dataclass -class ApiResponseForDefault(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_default = api_client.OpenApiResponse( - response_cls=ApiResponseForDefault, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _delete_coffee_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _delete_coffee_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _delete_coffee_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _delete_coffee_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - Delete coffee - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) - used_path = path.value - - _path_params = {} - for parameter in ( - request_path_id, - ): - parameter_data = path_params.get(parameter.name, schemas.unset) - if parameter_data is schemas.unset: - continue - serialized_data = parameter.serialize(parameter_data) - _path_params.update(serialized_data) - - for k, v in _path_params.items(): - used_path = used_path.replace('{%s}' % k, v) - # TODO add cookie handling - - response = self.api_client.call_api( - resource_path=used_path, - method='delete'.upper(), - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class DeleteCoffee(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def delete_coffee( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def delete_coffee( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def delete_coffee( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def delete_coffee( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._delete_coffee_oapg( - path_params=path_params, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiFordelete(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def delete( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def delete( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def delete( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def delete( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._delete_coffee_oapg( - path_params=path_params, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_delete_coffee_id/delete/__init__.py b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_delete_coffee_id/delete/__init__.py new file mode 100644 index 00000000000..2e0c3e6818e --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_delete_coffee_id/delete/__init__.py @@ -0,0 +1,262 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 +from . import response_for_default + + + +class RequestPathParameters: + class Schemas: + id = schemas.StrSchema + + + RequiredParams = typing_extensions.TypedDict( + 'RequiredParams', + { + 'id': typing.Union[Schemas.id, str, ], + } + ) + OptionalParams = typing_extensions.TypedDict( + 'OptionalParams', + { + }, + total=False + ) + + + class Params(RequiredParams, OptionalParams): + pass + + + parameters = [ + api_client.PathParameter( + name="id", + style=api_client.ParameterStyle.SIMPLE, + schema=Schemas.id, + required=True, + ), + ] +_status_code_to_response = { + '200': response_for_200.response, + 'default': response_for_default.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _delete_coffee_oapg( + self, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + response_for_default.ApiResponse, + ]: ... + + @typing.overload + def _delete_coffee_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _delete_coffee_oapg( + self, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + response_for_default.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _delete_coffee_oapg( + self, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + Delete coffee + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + self._verify_typed_dict_inputs_oapg(RequestPathParameters.Params, path_params) + used_path = path.value + + _path_params = {} + for parameter in RequestPathParameters.parameters: + parameter_data = path_params.get(parameter.name, schemas.unset) + if parameter_data is schemas.unset: + continue + serialized_data = parameter.serialize(parameter_data) + _path_params.update(serialized_data) + + for k, v in _path_params.items(): + used_path = used_path.replace('{%s}' % k, v) + # TODO add cookie handling + + response = self.api_client.call_api( + resource_path=used_path, + method='delete'.upper(), + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class DeleteCoffee(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def delete_coffee( + self, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + response_for_default.ApiResponse, + ]: ... + + @typing.overload + def delete_coffee( + self, + skip_deserialization: typing_extensions.Literal[True], + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def delete_coffee( + self, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + response_for_default.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def delete_coffee( + self, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._delete_coffee_oapg( + path_params=path_params, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiFordelete(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def delete( + self, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + response_for_default.ApiResponse, + ]: ... + + @typing.overload + def delete( + self, + skip_deserialization: typing_extensions.Literal[True], + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def delete( + self, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + response_for_default.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def delete( + self, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._delete_coffee_oapg( + path_params=path_params, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_delete_coffee_id/delete/__init__.pyi b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_delete_coffee_id/delete/__init__.pyi new file mode 100644 index 00000000000..eb86b5b2807 --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_delete_coffee_id/delete/__init__.pyi @@ -0,0 +1,256 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from . import response_for_200 +from . import response_for_default + + + +class RequestPathParameters: + class Schemas: + id = schemas.StrSchema + + + RequiredParams = typing_extensions.TypedDict( + 'RequiredParams', + { + 'id': typing.Union[Schemas.id, str, ], + } + ) + OptionalParams = typing_extensions.TypedDict( + 'OptionalParams', + { + }, + total=False + ) + + + class Params(RequiredParams, OptionalParams): + pass + + + parameters = [ + api_client.PathParameter( + name="id", + style=api_client.ParameterStyle.SIMPLE, + schema=Schemas.id, + required=True, + ), + ] + +class BaseApi(api_client.Api): + @typing.overload + def _delete_coffee_oapg( + self, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + response_for_default.ApiResponse, + ]: ... + + @typing.overload + def _delete_coffee_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _delete_coffee_oapg( + self, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + response_for_default.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _delete_coffee_oapg( + self, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + Delete coffee + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + self._verify_typed_dict_inputs_oapg(RequestPathParameters.Params, path_params) + used_path = path.value + + _path_params = {} + for parameter in RequestPathParameters.parameters: + parameter_data = path_params.get(parameter.name, schemas.unset) + if parameter_data is schemas.unset: + continue + serialized_data = parameter.serialize(parameter_data) + _path_params.update(serialized_data) + + for k, v in _path_params.items(): + used_path = used_path.replace('{%s}' % k, v) + # TODO add cookie handling + + response = self.api_client.call_api( + resource_path=used_path, + method='delete'.upper(), + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class DeleteCoffee(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def delete_coffee( + self, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + response_for_default.ApiResponse, + ]: ... + + @typing.overload + def delete_coffee( + self, + skip_deserialization: typing_extensions.Literal[True], + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def delete_coffee( + self, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + response_for_default.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def delete_coffee( + self, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._delete_coffee_oapg( + path_params=path_params, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiFordelete(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def delete( + self, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + response_for_default.ApiResponse, + ]: ... + + @typing.overload + def delete( + self, + skip_deserialization: typing_extensions.Literal[True], + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def delete( + self, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + response_for_default.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def delete( + self, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._delete_coffee_oapg( + path_params=path_params, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_delete_coffee_id/delete/response_for_200.py b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_delete_coffee_id/delete/response_for_200.py new file mode 100644 index 00000000000..7ec95a8627a --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_delete_coffee_id/delete/response_for_200.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from petstore_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_delete_coffee_id/delete/response_for_default.py b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_delete_coffee_id/delete/response_for_default.py new file mode 100644 index 00000000000..7ec95a8627a --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_delete_coffee_id/delete/response_for_default.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from petstore_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_health/get.py b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_health/get.py deleted file mode 100644 index 448891337f1..00000000000 --- a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_health/get.py +++ /dev/null @@ -1,235 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from petstore_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from petstore_api import schemas # noqa: F401 - -from petstore_api.model.health_check_result import HealthCheckResult - -from . import path - -SchemaFor200ResponseBodyApplicationJson = HealthCheckResult - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_status_code_to_response = { - '200': _response_for_200, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _fake_health_get_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _fake_health_get_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _fake_health_get_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _fake_health_get_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - Health check endpoint - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='get'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class FakeHealthGet(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def fake_health_get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def fake_health_get( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def fake_health_get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def fake_health_get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._fake_health_get_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForget(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def get( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._fake_health_get_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_health/get.pyi b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_health/get.pyi deleted file mode 100644 index 5782ac9c7e7..00000000000 --- a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_health/get.pyi +++ /dev/null @@ -1,230 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from petstore_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from petstore_api import schemas # noqa: F401 - -from petstore_api.model.health_check_result import HealthCheckResult - -SchemaFor200ResponseBodyApplicationJson = HealthCheckResult - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _fake_health_get_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _fake_health_get_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _fake_health_get_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _fake_health_get_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - Health check endpoint - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='get'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class FakeHealthGet(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def fake_health_get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def fake_health_get( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def fake_health_get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def fake_health_get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._fake_health_get_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForget(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def get( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._fake_health_get_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_health/get/__init__.py b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_health/get/__init__.py new file mode 100644 index 00000000000..c4593658606 --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_health/get/__init__.py @@ -0,0 +1,216 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 + + +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _fake_health_get_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _fake_health_get_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _fake_health_get_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _fake_health_get_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + Health check endpoint + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='get'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class FakeHealthGet(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def fake_health_get( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def fake_health_get( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def fake_health_get( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def fake_health_get( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._fake_health_get_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForget(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def get( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def get( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def get( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def get( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._fake_health_get_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_health/get/__init__.pyi b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_health/get/__init__.pyi new file mode 100644 index 00000000000..db7166d2f63 --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_health/get/__init__.pyi @@ -0,0 +1,211 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from . import response_for_200 + +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _fake_health_get_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _fake_health_get_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _fake_health_get_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _fake_health_get_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + Health check endpoint + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='get'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class FakeHealthGet(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def fake_health_get( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def fake_health_get( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def fake_health_get( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def fake_health_get( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._fake_health_get_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForget(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def get( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def get( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def get( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def get( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._fake_health_get_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_health/get/response_for_200.py b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_health/get/response_for_200.py new file mode 100644 index 00000000000..bb59ed13e40 --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_health/get/response_for_200.py @@ -0,0 +1,43 @@ +import dataclasses +import urllib3 + +from petstore_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from petstore_api.model.health_check_result import HealthCheckResult + + +class BodySchemas: + # body schemas + application_json = HealthCheckResult + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_inline_additional_properties/post.py b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_inline_additional_properties/post.py deleted file mode 100644 index 2363305f7cb..00000000000 --- a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_inline_additional_properties/post.py +++ /dev/null @@ -1,325 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from petstore_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from petstore_api import schemas # noqa: F401 - -from . import path - -# body param - - -class SchemaForRequestBodyApplicationJson( - schemas.DictSchema -): - - - class MetaOapg: - additional_properties = schemas.StrSchema - - def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: - # dict_instance[name] accessor - return super().__getitem__(name) - - def get_item_oapg(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: - return super().get_item_oapg(name) - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, ], - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[MetaOapg.additional_properties, str, ], - ) -> 'SchemaForRequestBodyApplicationJson': - return super().__new__( - cls, - *args, - _configuration=_configuration, - **kwargs, - ) - - -request_body_request_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) -_status_code_to_response = { - '200': _response_for_200, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _inline_additional_properties_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _inline_additional_properties_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _inline_additional_properties_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _inline_additional_properties_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _inline_additional_properties_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - test inline additionalProperties - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_request_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class InlineAdditionalProperties(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def inline_additional_properties( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def inline_additional_properties( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def inline_additional_properties( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def inline_additional_properties( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def inline_additional_properties( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._inline_additional_properties_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._inline_additional_properties_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_inline_additional_properties/post.pyi b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_inline_additional_properties/post.pyi deleted file mode 100644 index 71113ab91af..00000000000 --- a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_inline_additional_properties/post.pyi +++ /dev/null @@ -1,320 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from petstore_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from petstore_api import schemas # noqa: F401 - -# body param - - -class SchemaForRequestBodyApplicationJson( - schemas.DictSchema -): - - - class MetaOapg: - additional_properties = schemas.StrSchema - - def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: - # dict_instance[name] accessor - return super().__getitem__(name) - - def get_item_oapg(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: - return super().get_item_oapg(name) - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, ], - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[MetaOapg.additional_properties, str, ], - ) -> 'SchemaForRequestBodyApplicationJson': - return super().__new__( - cls, - *args, - _configuration=_configuration, - **kwargs, - ) - - -request_body_request_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _inline_additional_properties_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _inline_additional_properties_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _inline_additional_properties_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _inline_additional_properties_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _inline_additional_properties_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - test inline additionalProperties - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_request_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class InlineAdditionalProperties(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def inline_additional_properties( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def inline_additional_properties( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def inline_additional_properties( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def inline_additional_properties( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def inline_additional_properties( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._inline_additional_properties_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._inline_additional_properties_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_inline_additional_properties/post/__init__.py b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_inline_additional_properties/post/__init__.py new file mode 100644 index 00000000000..ec6f97d0ed2 --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_inline_additional_properties/post/__init__.py @@ -0,0 +1,318 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 + + + +class RequestBody: + class Schemas: + + + class application_json( + schemas.DictSchema + ): + + + class MetaOapg: + additional_properties = schemas.StrSchema + + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: + # dict_instance[name] accessor + return super().__getitem__(name) + + def get_item_oapg(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: + return super().get_item_oapg(name) + + def __new__( + cls, + *args: typing.Union[dict, frozendict.frozendict, ], + _configuration: typing.Optional[schemas.Configuration] = None, + **kwargs: typing.Union[MetaOapg.additional_properties, str, ], + ) -> 'application_json': + return super().__new__( + cls, + *args, + _configuration=_configuration, + **kwargs, + ) + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + +_status_code_to_response = { + '200': response_for_200.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _inline_additional_properties_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,dict, frozendict.frozendict, ], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _inline_additional_properties_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,dict, frozendict.frozendict, ], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _inline_additional_properties_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,dict, frozendict.frozendict, ], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _inline_additional_properties_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,dict, frozendict.frozendict, ], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _inline_additional_properties_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,dict, frozendict.frozendict, ], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + test inline additionalProperties + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class InlineAdditionalProperties(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def inline_additional_properties( + self, + body: typing.Union[RequestBody.Schemas.application_json,dict, frozendict.frozendict, ], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def inline_additional_properties( + self, + body: typing.Union[RequestBody.Schemas.application_json,dict, frozendict.frozendict, ], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def inline_additional_properties( + self, + body: typing.Union[RequestBody.Schemas.application_json,dict, frozendict.frozendict, ], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def inline_additional_properties( + self, + body: typing.Union[RequestBody.Schemas.application_json,dict, frozendict.frozendict, ], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def inline_additional_properties( + self, + body: typing.Union[RequestBody.Schemas.application_json,dict, frozendict.frozendict, ], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._inline_additional_properties_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,dict, frozendict.frozendict, ], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,dict, frozendict.frozendict, ], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,dict, frozendict.frozendict, ], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,dict, frozendict.frozendict, ], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,dict, frozendict.frozendict, ], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._inline_additional_properties_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_inline_additional_properties/post/__init__.pyi b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_inline_additional_properties/post/__init__.pyi new file mode 100644 index 00000000000..33b09504fb4 --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_inline_additional_properties/post/__init__.pyi @@ -0,0 +1,313 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from . import response_for_200 + + + +class RequestBody: + class Schemas: + + + class application_json( + schemas.DictSchema + ): + + + class MetaOapg: + additional_properties = schemas.StrSchema + + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: + # dict_instance[name] accessor + return super().__getitem__(name) + + def get_item_oapg(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: + return super().get_item_oapg(name) + + def __new__( + cls, + *args: typing.Union[dict, frozendict.frozendict, ], + _configuration: typing.Optional[schemas.Configuration] = None, + **kwargs: typing.Union[MetaOapg.additional_properties, str, ], + ) -> 'application_json': + return super().__new__( + cls, + *args, + _configuration=_configuration, + **kwargs, + ) + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + + +class BaseApi(api_client.Api): + @typing.overload + def _inline_additional_properties_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,dict, frozendict.frozendict, ], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _inline_additional_properties_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,dict, frozendict.frozendict, ], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _inline_additional_properties_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,dict, frozendict.frozendict, ], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _inline_additional_properties_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,dict, frozendict.frozendict, ], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _inline_additional_properties_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,dict, frozendict.frozendict, ], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + test inline additionalProperties + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class InlineAdditionalProperties(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def inline_additional_properties( + self, + body: typing.Union[RequestBody.Schemas.application_json,dict, frozendict.frozendict, ], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def inline_additional_properties( + self, + body: typing.Union[RequestBody.Schemas.application_json,dict, frozendict.frozendict, ], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def inline_additional_properties( + self, + body: typing.Union[RequestBody.Schemas.application_json,dict, frozendict.frozendict, ], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def inline_additional_properties( + self, + body: typing.Union[RequestBody.Schemas.application_json,dict, frozendict.frozendict, ], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def inline_additional_properties( + self, + body: typing.Union[RequestBody.Schemas.application_json,dict, frozendict.frozendict, ], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._inline_additional_properties_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,dict, frozendict.frozendict, ], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,dict, frozendict.frozendict, ], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,dict, frozendict.frozendict, ], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,dict, frozendict.frozendict, ], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,dict, frozendict.frozendict, ], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._inline_additional_properties_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_inline_additional_properties/post/response_for_200.py b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_inline_additional_properties/post/response_for_200.py new file mode 100644 index 00000000000..7ec95a8627a --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_inline_additional_properties/post/response_for_200.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from petstore_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_inline_composition_/post.py b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_inline_composition_/post.py deleted file mode 100644 index d7904db7a88..00000000000 --- a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_inline_composition_/post.py +++ /dev/null @@ -1,851 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from petstore_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from petstore_api import schemas # noqa: F401 - -from . import path - -# Query params - - -class CompositionAtRootSchema( - schemas.ComposedSchema, -): - - - class MetaOapg: - - - class all_of_0( - schemas.StrSchema - ): - - - class MetaOapg: - min_length = 1 - - @classmethod - @functools.lru_cache() - def all_of(cls): - # we need this here to make our import statements work - # we must store _composed_schemas in here so the code is only run - # when we invoke this method. If we kept this at the class - # level we would get an error because the class level - # code would be run when this module is imported, and these composed - # classes don't exist yet because their module has not finished - # loading - return [ - cls.all_of_0, - ] - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'CompositionAtRootSchema': - return super().__new__( - cls, - *args, - _configuration=_configuration, - **kwargs, - ) - - -class CompositionInPropertySchema( - schemas.DictSchema -): - - - class MetaOapg: - - class properties: - - - class someProp( - schemas.ComposedSchema, - ): - - - class MetaOapg: - - - class all_of_0( - schemas.StrSchema - ): - - - class MetaOapg: - min_length = 1 - - @classmethod - @functools.lru_cache() - def all_of(cls): - # we need this here to make our import statements work - # we must store _composed_schemas in here so the code is only run - # when we invoke this method. If we kept this at the class - # level we would get an error because the class level - # code would be run when this module is imported, and these composed - # classes don't exist yet because their module has not finished - # loading - return [ - cls.all_of_0, - ] - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'someProp': - return super().__new__( - cls, - *args, - _configuration=_configuration, - **kwargs, - ) - __annotations__ = { - "someProp": someProp, - } - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["someProp"]) -> MetaOapg.properties.someProp: ... - - @typing.overload - def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... - - def __getitem__(self, name: typing.Union[typing_extensions.Literal["someProp", ], str]): - # dict_instance[name] accessor - return super().__getitem__(name) - - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["someProp"]) -> typing.Union[MetaOapg.properties.someProp, schemas.Unset]: ... - - @typing.overload - def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... - - def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["someProp", ], str]): - return super().get_item_oapg(name) - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, ], - someProp: typing.Union[MetaOapg.properties.someProp, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'CompositionInPropertySchema': - return super().__new__( - cls, - *args, - someProp=someProp, - _configuration=_configuration, - **kwargs, - ) -RequestRequiredQueryParams = typing_extensions.TypedDict( - 'RequestRequiredQueryParams', - { - } -) -RequestOptionalQueryParams = typing_extensions.TypedDict( - 'RequestOptionalQueryParams', - { - 'compositionAtRoot': typing.Union[CompositionAtRootSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - 'compositionInProperty': typing.Union[CompositionInPropertySchema, dict, frozendict.frozendict, ], - }, - total=False -) - - -class RequestQueryParams(RequestRequiredQueryParams, RequestOptionalQueryParams): - pass - - -request_query_composition_at_root = api_client.QueryParameter( - name="compositionAtRoot", - style=api_client.ParameterStyle.FORM, - schema=CompositionAtRootSchema, - explode=True, -) -request_query_composition_in_property = api_client.QueryParameter( - name="compositionInProperty", - style=api_client.ParameterStyle.FORM, - schema=CompositionInPropertySchema, - explode=True, -) -# body param - - -class SchemaForRequestBodyApplicationJson( - schemas.ComposedSchema, -): - - - class MetaOapg: - - - class all_of_0( - schemas.StrSchema - ): - - - class MetaOapg: - min_length = 1 - - @classmethod - @functools.lru_cache() - def all_of(cls): - # we need this here to make our import statements work - # we must store _composed_schemas in here so the code is only run - # when we invoke this method. If we kept this at the class - # level we would get an error because the class level - # code would be run when this module is imported, and these composed - # classes don't exist yet because their module has not finished - # loading - return [ - cls.all_of_0, - ] - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'SchemaForRequestBodyApplicationJson': - return super().__new__( - cls, - *args, - _configuration=_configuration, - **kwargs, - ) - - -class SchemaForRequestBodyMultipartFormData( - schemas.DictSchema -): - - - class MetaOapg: - - class properties: - - - class someProp( - schemas.ComposedSchema, - ): - - - class MetaOapg: - - - class all_of_0( - schemas.StrSchema - ): - - - class MetaOapg: - min_length = 1 - - @classmethod - @functools.lru_cache() - def all_of(cls): - # we need this here to make our import statements work - # we must store _composed_schemas in here so the code is only run - # when we invoke this method. If we kept this at the class - # level we would get an error because the class level - # code would be run when this module is imported, and these composed - # classes don't exist yet because their module has not finished - # loading - return [ - cls.all_of_0, - ] - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'someProp': - return super().__new__( - cls, - *args, - _configuration=_configuration, - **kwargs, - ) - __annotations__ = { - "someProp": someProp, - } - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["someProp"]) -> MetaOapg.properties.someProp: ... - - @typing.overload - def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... - - def __getitem__(self, name: typing.Union[typing_extensions.Literal["someProp", ], str]): - # dict_instance[name] accessor - return super().__getitem__(name) - - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["someProp"]) -> typing.Union[MetaOapg.properties.someProp, schemas.Unset]: ... - - @typing.overload - def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... - - def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["someProp", ], str]): - return super().get_item_oapg(name) - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, ], - someProp: typing.Union[MetaOapg.properties.someProp, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'SchemaForRequestBodyMultipartFormData': - return super().__new__( - cls, - *args, - someProp=someProp, - _configuration=_configuration, - **kwargs, - ) - - -request_body_any_type = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - 'multipart/form-data': api_client.MediaType( - schema=SchemaForRequestBodyMultipartFormData), - }, -) - - -class SchemaFor200ResponseBodyApplicationJson( - schemas.ComposedSchema, -): - - - class MetaOapg: - - - class all_of_0( - schemas.StrSchema - ): - - - class MetaOapg: - min_length = 1 - - @classmethod - @functools.lru_cache() - def all_of(cls): - # we need this here to make our import statements work - # we must store _composed_schemas in here so the code is only run - # when we invoke this method. If we kept this at the class - # level we would get an error because the class level - # code would be run when this module is imported, and these composed - # classes don't exist yet because their module has not finished - # loading - return [ - cls.all_of_0, - ] - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'SchemaFor200ResponseBodyApplicationJson': - return super().__new__( - cls, - *args, - _configuration=_configuration, - **kwargs, - ) - - -class SchemaFor200ResponseBodyMultipartFormData( - schemas.DictSchema -): - - - class MetaOapg: - - class properties: - - - class someProp( - schemas.ComposedSchema, - ): - - - class MetaOapg: - - - class all_of_0( - schemas.StrSchema - ): - - - class MetaOapg: - min_length = 1 - - @classmethod - @functools.lru_cache() - def all_of(cls): - # we need this here to make our import statements work - # we must store _composed_schemas in here so the code is only run - # when we invoke this method. If we kept this at the class - # level we would get an error because the class level - # code would be run when this module is imported, and these composed - # classes don't exist yet because their module has not finished - # loading - return [ - cls.all_of_0, - ] - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'someProp': - return super().__new__( - cls, - *args, - _configuration=_configuration, - **kwargs, - ) - __annotations__ = { - "someProp": someProp, - } - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["someProp"]) -> MetaOapg.properties.someProp: ... - - @typing.overload - def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... - - def __getitem__(self, name: typing.Union[typing_extensions.Literal["someProp", ], str]): - # dict_instance[name] accessor - return super().__getitem__(name) - - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["someProp"]) -> typing.Union[MetaOapg.properties.someProp, schemas.Unset]: ... - - @typing.overload - def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... - - def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["someProp", ], str]): - return super().get_item_oapg(name) - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, ], - someProp: typing.Union[MetaOapg.properties.someProp, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'SchemaFor200ResponseBodyMultipartFormData': - return super().__new__( - cls, - *args, - someProp=someProp, - _configuration=_configuration, - **kwargs, - ) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - SchemaFor200ResponseBodyMultipartFormData, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - 'multipart/form-data': api_client.MediaType( - schema=SchemaFor200ResponseBodyMultipartFormData), - }, -) -_status_code_to_response = { - '200': _response_for_200, -} -_all_accept_content_types = ( - 'application/json', - 'multipart/form-data', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _inline_composition_oapg( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _inline_composition_oapg( - self, - content_type: typing_extensions.Literal["multipart/form-data"], - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _inline_composition_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _inline_composition_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _inline_composition_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _inline_composition_oapg( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - testing composed schemas at inline locations - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - self._verify_typed_dict_inputs_oapg(RequestQueryParams, query_params) - used_path = path.value - - prefix_separator_iterator = None - for parameter in ( - request_query_composition_at_root, - request_query_composition_in_property, - ): - parameter_data = query_params.get(parameter.name, schemas.unset) - if parameter_data is schemas.unset: - continue - if prefix_separator_iterator is None: - prefix_separator_iterator = parameter.get_prefix_separator_iterator() - serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) - for serialized_value in serialized_data.values(): - used_path += serialized_value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - _fields = None - _body = None - if body is not schemas.unset: - serialized_data = request_body_any_type.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class InlineComposition(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def inline_composition( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def inline_composition( - self, - content_type: typing_extensions.Literal["multipart/form-data"], - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def inline_composition( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def inline_composition( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def inline_composition( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def inline_composition( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._inline_composition_oapg( - body=body, - query_params=query_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - content_type: typing_extensions.Literal["multipart/form-data"], - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._inline_composition_oapg( - body=body, - query_params=query_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_inline_composition_/post.pyi b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_inline_composition_/post.pyi deleted file mode 100644 index 56503791e7b..00000000000 --- a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_inline_composition_/post.pyi +++ /dev/null @@ -1,828 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from petstore_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from petstore_api import schemas # noqa: F401 - -# Query params - - -class CompositionAtRootSchema( - schemas.ComposedSchema, -): - - - class MetaOapg: - - - class all_of_0( - schemas.StrSchema - ): - pass - - @classmethod - @functools.lru_cache() - def all_of(cls): - # we need this here to make our import statements work - # we must store _composed_schemas in here so the code is only run - # when we invoke this method. If we kept this at the class - # level we would get an error because the class level - # code would be run when this module is imported, and these composed - # classes don't exist yet because their module has not finished - # loading - return [ - cls.all_of_0, - ] - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'CompositionAtRootSchema': - return super().__new__( - cls, - *args, - _configuration=_configuration, - **kwargs, - ) - - -class CompositionInPropertySchema( - schemas.DictSchema -): - - - class MetaOapg: - - class properties: - - - class someProp( - schemas.ComposedSchema, - ): - - - class MetaOapg: - - - class all_of_0( - schemas.StrSchema - ): - pass - - @classmethod - @functools.lru_cache() - def all_of(cls): - # we need this here to make our import statements work - # we must store _composed_schemas in here so the code is only run - # when we invoke this method. If we kept this at the class - # level we would get an error because the class level - # code would be run when this module is imported, and these composed - # classes don't exist yet because their module has not finished - # loading - return [ - cls.all_of_0, - ] - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'someProp': - return super().__new__( - cls, - *args, - _configuration=_configuration, - **kwargs, - ) - __annotations__ = { - "someProp": someProp, - } - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["someProp"]) -> MetaOapg.properties.someProp: ... - - @typing.overload - def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... - - def __getitem__(self, name: typing.Union[typing_extensions.Literal["someProp", ], str]): - # dict_instance[name] accessor - return super().__getitem__(name) - - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["someProp"]) -> typing.Union[MetaOapg.properties.someProp, schemas.Unset]: ... - - @typing.overload - def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... - - def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["someProp", ], str]): - return super().get_item_oapg(name) - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, ], - someProp: typing.Union[MetaOapg.properties.someProp, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'CompositionInPropertySchema': - return super().__new__( - cls, - *args, - someProp=someProp, - _configuration=_configuration, - **kwargs, - ) -RequestRequiredQueryParams = typing_extensions.TypedDict( - 'RequestRequiredQueryParams', - { - } -) -RequestOptionalQueryParams = typing_extensions.TypedDict( - 'RequestOptionalQueryParams', - { - 'compositionAtRoot': typing.Union[CompositionAtRootSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - 'compositionInProperty': typing.Union[CompositionInPropertySchema, dict, frozendict.frozendict, ], - }, - total=False -) - - -class RequestQueryParams(RequestRequiredQueryParams, RequestOptionalQueryParams): - pass - - -request_query_composition_at_root = api_client.QueryParameter( - name="compositionAtRoot", - style=api_client.ParameterStyle.FORM, - schema=CompositionAtRootSchema, - explode=True, -) -request_query_composition_in_property = api_client.QueryParameter( - name="compositionInProperty", - style=api_client.ParameterStyle.FORM, - schema=CompositionInPropertySchema, - explode=True, -) -# body param - - -class SchemaForRequestBodyApplicationJson( - schemas.ComposedSchema, -): - - - class MetaOapg: - - - class all_of_0( - schemas.StrSchema - ): - pass - - @classmethod - @functools.lru_cache() - def all_of(cls): - # we need this here to make our import statements work - # we must store _composed_schemas in here so the code is only run - # when we invoke this method. If we kept this at the class - # level we would get an error because the class level - # code would be run when this module is imported, and these composed - # classes don't exist yet because their module has not finished - # loading - return [ - cls.all_of_0, - ] - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'SchemaForRequestBodyApplicationJson': - return super().__new__( - cls, - *args, - _configuration=_configuration, - **kwargs, - ) - - -class SchemaForRequestBodyMultipartFormData( - schemas.DictSchema -): - - - class MetaOapg: - - class properties: - - - class someProp( - schemas.ComposedSchema, - ): - - - class MetaOapg: - - - class all_of_0( - schemas.StrSchema - ): - pass - - @classmethod - @functools.lru_cache() - def all_of(cls): - # we need this here to make our import statements work - # we must store _composed_schemas in here so the code is only run - # when we invoke this method. If we kept this at the class - # level we would get an error because the class level - # code would be run when this module is imported, and these composed - # classes don't exist yet because their module has not finished - # loading - return [ - cls.all_of_0, - ] - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'someProp': - return super().__new__( - cls, - *args, - _configuration=_configuration, - **kwargs, - ) - __annotations__ = { - "someProp": someProp, - } - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["someProp"]) -> MetaOapg.properties.someProp: ... - - @typing.overload - def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... - - def __getitem__(self, name: typing.Union[typing_extensions.Literal["someProp", ], str]): - # dict_instance[name] accessor - return super().__getitem__(name) - - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["someProp"]) -> typing.Union[MetaOapg.properties.someProp, schemas.Unset]: ... - - @typing.overload - def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... - - def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["someProp", ], str]): - return super().get_item_oapg(name) - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, ], - someProp: typing.Union[MetaOapg.properties.someProp, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'SchemaForRequestBodyMultipartFormData': - return super().__new__( - cls, - *args, - someProp=someProp, - _configuration=_configuration, - **kwargs, - ) - - -request_body_any_type = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - 'multipart/form-data': api_client.MediaType( - schema=SchemaForRequestBodyMultipartFormData), - }, -) - - -class SchemaFor200ResponseBodyApplicationJson( - schemas.ComposedSchema, -): - - - class MetaOapg: - - - class all_of_0( - schemas.StrSchema - ): - pass - - @classmethod - @functools.lru_cache() - def all_of(cls): - # we need this here to make our import statements work - # we must store _composed_schemas in here so the code is only run - # when we invoke this method. If we kept this at the class - # level we would get an error because the class level - # code would be run when this module is imported, and these composed - # classes don't exist yet because their module has not finished - # loading - return [ - cls.all_of_0, - ] - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'SchemaFor200ResponseBodyApplicationJson': - return super().__new__( - cls, - *args, - _configuration=_configuration, - **kwargs, - ) - - -class SchemaFor200ResponseBodyMultipartFormData( - schemas.DictSchema -): - - - class MetaOapg: - - class properties: - - - class someProp( - schemas.ComposedSchema, - ): - - - class MetaOapg: - - - class all_of_0( - schemas.StrSchema - ): - pass - - @classmethod - @functools.lru_cache() - def all_of(cls): - # we need this here to make our import statements work - # we must store _composed_schemas in here so the code is only run - # when we invoke this method. If we kept this at the class - # level we would get an error because the class level - # code would be run when this module is imported, and these composed - # classes don't exist yet because their module has not finished - # loading - return [ - cls.all_of_0, - ] - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'someProp': - return super().__new__( - cls, - *args, - _configuration=_configuration, - **kwargs, - ) - __annotations__ = { - "someProp": someProp, - } - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["someProp"]) -> MetaOapg.properties.someProp: ... - - @typing.overload - def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... - - def __getitem__(self, name: typing.Union[typing_extensions.Literal["someProp", ], str]): - # dict_instance[name] accessor - return super().__getitem__(name) - - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["someProp"]) -> typing.Union[MetaOapg.properties.someProp, schemas.Unset]: ... - - @typing.overload - def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... - - def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["someProp", ], str]): - return super().get_item_oapg(name) - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, ], - someProp: typing.Union[MetaOapg.properties.someProp, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'SchemaFor200ResponseBodyMultipartFormData': - return super().__new__( - cls, - *args, - someProp=someProp, - _configuration=_configuration, - **kwargs, - ) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - SchemaFor200ResponseBodyMultipartFormData, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - 'multipart/form-data': api_client.MediaType( - schema=SchemaFor200ResponseBodyMultipartFormData), - }, -) -_all_accept_content_types = ( - 'application/json', - 'multipart/form-data', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _inline_composition_oapg( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _inline_composition_oapg( - self, - content_type: typing_extensions.Literal["multipart/form-data"], - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _inline_composition_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _inline_composition_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _inline_composition_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _inline_composition_oapg( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - testing composed schemas at inline locations - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - self._verify_typed_dict_inputs_oapg(RequestQueryParams, query_params) - used_path = path.value - - prefix_separator_iterator = None - for parameter in ( - request_query_composition_at_root, - request_query_composition_in_property, - ): - parameter_data = query_params.get(parameter.name, schemas.unset) - if parameter_data is schemas.unset: - continue - if prefix_separator_iterator is None: - prefix_separator_iterator = parameter.get_prefix_separator_iterator() - serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) - for serialized_value in serialized_data.values(): - used_path += serialized_value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - _fields = None - _body = None - if body is not schemas.unset: - serialized_data = request_body_any_type.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class InlineComposition(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def inline_composition( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def inline_composition( - self, - content_type: typing_extensions.Literal["multipart/form-data"], - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def inline_composition( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def inline_composition( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def inline_composition( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def inline_composition( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._inline_composition_oapg( - body=body, - query_params=query_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - content_type: typing_extensions.Literal["multipart/form-data"], - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._inline_composition_oapg( - body=body, - query_params=query_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_inline_composition_/post/__init__.py b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_inline_composition_/post/__init__.py new file mode 100644 index 00000000000..a9eb4d018a0 --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_inline_composition_/post/__init__.py @@ -0,0 +1,700 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 + + + +class RequestQueryParameters: + class Schemas: + + + class compositionAtRoot( + schemas.ComposedSchema, + ): + + + class MetaOapg: + + + class all_of_0( + schemas.StrSchema + ): + + + class MetaOapg: + min_length = 1 + + @classmethod + @functools.lru_cache() + def all_of(cls): + # we need this here to make our import statements work + # we must store _composed_schemas in here so the code is only run + # when we invoke this method. If we kept this at the class + # level we would get an error because the class level + # code would be run when this module is imported, and these composed + # classes don't exist yet because their module has not finished + # loading + return [ + cls.all_of_0, + ] + + + def __new__( + cls, + *args: typing.Union[dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], + _configuration: typing.Optional[schemas.Configuration] = None, + **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], + ) -> 'compositionAtRoot': + return super().__new__( + cls, + *args, + _configuration=_configuration, + **kwargs, + ) + + + class compositionInProperty( + schemas.DictSchema + ): + + + class MetaOapg: + + class properties: + + + class someProp( + schemas.ComposedSchema, + ): + + + class MetaOapg: + + + class all_of_0( + schemas.StrSchema + ): + + + class MetaOapg: + min_length = 1 + + @classmethod + @functools.lru_cache() + def all_of(cls): + # we need this here to make our import statements work + # we must store _composed_schemas in here so the code is only run + # when we invoke this method. If we kept this at the class + # level we would get an error because the class level + # code would be run when this module is imported, and these composed + # classes don't exist yet because their module has not finished + # loading + return [ + cls.all_of_0, + ] + + + def __new__( + cls, + *args: typing.Union[dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], + _configuration: typing.Optional[schemas.Configuration] = None, + **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], + ) -> 'someProp': + return super().__new__( + cls, + *args, + _configuration=_configuration, + **kwargs, + ) + __annotations__ = { + "someProp": someProp, + } + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["someProp"]) -> MetaOapg.properties.someProp: ... + + @typing.overload + def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... + + def __getitem__(self, name: typing.Union[typing_extensions.Literal["someProp", ], str]): + # dict_instance[name] accessor + return super().__getitem__(name) + + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["someProp"]) -> typing.Union[MetaOapg.properties.someProp, schemas.Unset]: ... + + @typing.overload + def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... + + def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["someProp", ], str]): + return super().get_item_oapg(name) + + + def __new__( + cls, + *args: typing.Union[dict, frozendict.frozendict, ], + someProp: typing.Union[MetaOapg.properties.someProp, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, + _configuration: typing.Optional[schemas.Configuration] = None, + **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], + ) -> 'compositionInProperty': + return super().__new__( + cls, + *args, + someProp=someProp, + _configuration=_configuration, + **kwargs, + ) + + + RequiredParams = typing_extensions.TypedDict( + 'RequiredParams', + { + } + ) + OptionalParams = typing_extensions.TypedDict( + 'OptionalParams', + { + 'compositionAtRoot': typing.Union[Schemas.compositionAtRoot, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], + 'compositionInProperty': typing.Union[Schemas.compositionInProperty, dict, frozendict.frozendict, ], + }, + total=False + ) + + + class Params(RequiredParams, OptionalParams): + pass + + + parameters = [ + api_client.QueryParameter( + name="compositionAtRoot", + style=api_client.ParameterStyle.FORM, + schema=Schemas.compositionAtRoot, + explode=True, + ), + api_client.QueryParameter( + name="compositionInProperty", + style=api_client.ParameterStyle.FORM, + schema=Schemas.compositionInProperty, + explode=True, + ), + ] + +class RequestBody: + class Schemas: + + + class application_json( + schemas.ComposedSchema, + ): + + + class MetaOapg: + + + class all_of_0( + schemas.StrSchema + ): + + + class MetaOapg: + min_length = 1 + + @classmethod + @functools.lru_cache() + def all_of(cls): + # we need this here to make our import statements work + # we must store _composed_schemas in here so the code is only run + # when we invoke this method. If we kept this at the class + # level we would get an error because the class level + # code would be run when this module is imported, and these composed + # classes don't exist yet because their module has not finished + # loading + return [ + cls.all_of_0, + ] + + + def __new__( + cls, + *args: typing.Union[dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], + _configuration: typing.Optional[schemas.Configuration] = None, + **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], + ) -> 'application_json': + return super().__new__( + cls, + *args, + _configuration=_configuration, + **kwargs, + ) + + + class multipart_form_data( + schemas.DictSchema + ): + + + class MetaOapg: + + class properties: + + + class someProp( + schemas.ComposedSchema, + ): + + + class MetaOapg: + + + class all_of_0( + schemas.StrSchema + ): + + + class MetaOapg: + min_length = 1 + + @classmethod + @functools.lru_cache() + def all_of(cls): + # we need this here to make our import statements work + # we must store _composed_schemas in here so the code is only run + # when we invoke this method. If we kept this at the class + # level we would get an error because the class level + # code would be run when this module is imported, and these composed + # classes don't exist yet because their module has not finished + # loading + return [ + cls.all_of_0, + ] + + + def __new__( + cls, + *args: typing.Union[dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], + _configuration: typing.Optional[schemas.Configuration] = None, + **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], + ) -> 'someProp': + return super().__new__( + cls, + *args, + _configuration=_configuration, + **kwargs, + ) + __annotations__ = { + "someProp": someProp, + } + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["someProp"]) -> MetaOapg.properties.someProp: ... + + @typing.overload + def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... + + def __getitem__(self, name: typing.Union[typing_extensions.Literal["someProp", ], str]): + # dict_instance[name] accessor + return super().__getitem__(name) + + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["someProp"]) -> typing.Union[MetaOapg.properties.someProp, schemas.Unset]: ... + + @typing.overload + def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... + + def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["someProp", ], str]): + return super().get_item_oapg(name) + + + def __new__( + cls, + *args: typing.Union[dict, frozendict.frozendict, ], + someProp: typing.Union[MetaOapg.properties.someProp, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, + _configuration: typing.Optional[schemas.Configuration] = None, + **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], + ) -> 'multipart_form_data': + return super().__new__( + cls, + *args, + someProp=someProp, + _configuration=_configuration, + **kwargs, + ) + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + 'multipart/form-data': api_client.MediaType( + schema=Schemas.multipart_form_data + ), + }, + ) + +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/json', + 'multipart/form-data', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _inline_composition_oapg( + self, + content_type: typing_extensions.Literal["application/json"] = ..., + body: typing.Union[RequestBody.Schemas.application_json, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _inline_composition_oapg( + self, + content_type: typing_extensions.Literal["multipart/form-data"], + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _inline_composition_oapg( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _inline_composition_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _inline_composition_oapg( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _inline_composition_oapg( + self, + content_type: str = 'application/json', + body: typing.Union[RequestBody.Schemas.application_json, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + testing composed schemas at inline locations + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + self._verify_typed_dict_inputs_oapg(RequestQueryParameters.Params, query_params) + used_path = path.value + + prefix_separator_iterator = None + for parameter in RequestQueryParameters.parameters: + parameter_data = query_params.get(parameter.name, schemas.unset) + if parameter_data is schemas.unset: + continue + if prefix_separator_iterator is None: + prefix_separator_iterator = parameter.get_prefix_separator_iterator() + serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) + for serialized_value in serialized_data.values(): + used_path += serialized_value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + _fields = None + _body = None + if body is not schemas.unset: + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class InlineComposition(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def inline_composition( + self, + content_type: typing_extensions.Literal["application/json"] = ..., + body: typing.Union[RequestBody.Schemas.application_json, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def inline_composition( + self, + content_type: typing_extensions.Literal["multipart/form-data"], + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def inline_composition( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def inline_composition( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def inline_composition( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def inline_composition( + self, + content_type: str = 'application/json', + body: typing.Union[RequestBody.Schemas.application_json, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._inline_composition_oapg( + body=body, + query_params=query_params, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + content_type: typing_extensions.Literal["application/json"] = ..., + body: typing.Union[RequestBody.Schemas.application_json, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + content_type: typing_extensions.Literal["multipart/form-data"], + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + content_type: str = 'application/json', + body: typing.Union[RequestBody.Schemas.application_json, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._inline_composition_oapg( + body=body, + query_params=query_params, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_inline_composition_/post/__init__.pyi b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_inline_composition_/post/__init__.pyi new file mode 100644 index 00000000000..8e4fe6583a6 --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_inline_composition_/post/__init__.pyi @@ -0,0 +1,683 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from . import response_for_200 + + + +class RequestQueryParameters: + class Schemas: + + + class compositionAtRoot( + schemas.ComposedSchema, + ): + + + class MetaOapg: + + + class all_of_0( + schemas.StrSchema + ): + pass + + @classmethod + @functools.lru_cache() + def all_of(cls): + # we need this here to make our import statements work + # we must store _composed_schemas in here so the code is only run + # when we invoke this method. If we kept this at the class + # level we would get an error because the class level + # code would be run when this module is imported, and these composed + # classes don't exist yet because their module has not finished + # loading + return [ + cls.all_of_0, + ] + + + def __new__( + cls, + *args: typing.Union[dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], + _configuration: typing.Optional[schemas.Configuration] = None, + **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], + ) -> 'compositionAtRoot': + return super().__new__( + cls, + *args, + _configuration=_configuration, + **kwargs, + ) + + + class compositionInProperty( + schemas.DictSchema + ): + + + class MetaOapg: + + class properties: + + + class someProp( + schemas.ComposedSchema, + ): + + + class MetaOapg: + + + class all_of_0( + schemas.StrSchema + ): + pass + + @classmethod + @functools.lru_cache() + def all_of(cls): + # we need this here to make our import statements work + # we must store _composed_schemas in here so the code is only run + # when we invoke this method. If we kept this at the class + # level we would get an error because the class level + # code would be run when this module is imported, and these composed + # classes don't exist yet because their module has not finished + # loading + return [ + cls.all_of_0, + ] + + + def __new__( + cls, + *args: typing.Union[dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], + _configuration: typing.Optional[schemas.Configuration] = None, + **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], + ) -> 'someProp': + return super().__new__( + cls, + *args, + _configuration=_configuration, + **kwargs, + ) + __annotations__ = { + "someProp": someProp, + } + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["someProp"]) -> MetaOapg.properties.someProp: ... + + @typing.overload + def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... + + def __getitem__(self, name: typing.Union[typing_extensions.Literal["someProp", ], str]): + # dict_instance[name] accessor + return super().__getitem__(name) + + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["someProp"]) -> typing.Union[MetaOapg.properties.someProp, schemas.Unset]: ... + + @typing.overload + def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... + + def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["someProp", ], str]): + return super().get_item_oapg(name) + + + def __new__( + cls, + *args: typing.Union[dict, frozendict.frozendict, ], + someProp: typing.Union[MetaOapg.properties.someProp, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, + _configuration: typing.Optional[schemas.Configuration] = None, + **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], + ) -> 'compositionInProperty': + return super().__new__( + cls, + *args, + someProp=someProp, + _configuration=_configuration, + **kwargs, + ) + + + RequiredParams = typing_extensions.TypedDict( + 'RequiredParams', + { + } + ) + OptionalParams = typing_extensions.TypedDict( + 'OptionalParams', + { + 'compositionAtRoot': typing.Union[Schemas.compositionAtRoot, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], + 'compositionInProperty': typing.Union[Schemas.compositionInProperty, dict, frozendict.frozendict, ], + }, + total=False + ) + + + class Params(RequiredParams, OptionalParams): + pass + + + parameters = [ + api_client.QueryParameter( + name="compositionAtRoot", + style=api_client.ParameterStyle.FORM, + schema=Schemas.compositionAtRoot, + explode=True, + ), + api_client.QueryParameter( + name="compositionInProperty", + style=api_client.ParameterStyle.FORM, + schema=Schemas.compositionInProperty, + explode=True, + ), + ] + +class RequestBody: + class Schemas: + + + class application_json( + schemas.ComposedSchema, + ): + + + class MetaOapg: + + + class all_of_0( + schemas.StrSchema + ): + pass + + @classmethod + @functools.lru_cache() + def all_of(cls): + # we need this here to make our import statements work + # we must store _composed_schemas in here so the code is only run + # when we invoke this method. If we kept this at the class + # level we would get an error because the class level + # code would be run when this module is imported, and these composed + # classes don't exist yet because their module has not finished + # loading + return [ + cls.all_of_0, + ] + + + def __new__( + cls, + *args: typing.Union[dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], + _configuration: typing.Optional[schemas.Configuration] = None, + **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], + ) -> 'application_json': + return super().__new__( + cls, + *args, + _configuration=_configuration, + **kwargs, + ) + + + class multipart_form_data( + schemas.DictSchema + ): + + + class MetaOapg: + + class properties: + + + class someProp( + schemas.ComposedSchema, + ): + + + class MetaOapg: + + + class all_of_0( + schemas.StrSchema + ): + pass + + @classmethod + @functools.lru_cache() + def all_of(cls): + # we need this here to make our import statements work + # we must store _composed_schemas in here so the code is only run + # when we invoke this method. If we kept this at the class + # level we would get an error because the class level + # code would be run when this module is imported, and these composed + # classes don't exist yet because their module has not finished + # loading + return [ + cls.all_of_0, + ] + + + def __new__( + cls, + *args: typing.Union[dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], + _configuration: typing.Optional[schemas.Configuration] = None, + **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], + ) -> 'someProp': + return super().__new__( + cls, + *args, + _configuration=_configuration, + **kwargs, + ) + __annotations__ = { + "someProp": someProp, + } + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["someProp"]) -> MetaOapg.properties.someProp: ... + + @typing.overload + def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... + + def __getitem__(self, name: typing.Union[typing_extensions.Literal["someProp", ], str]): + # dict_instance[name] accessor + return super().__getitem__(name) + + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["someProp"]) -> typing.Union[MetaOapg.properties.someProp, schemas.Unset]: ... + + @typing.overload + def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... + + def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["someProp", ], str]): + return super().get_item_oapg(name) + + + def __new__( + cls, + *args: typing.Union[dict, frozendict.frozendict, ], + someProp: typing.Union[MetaOapg.properties.someProp, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, + _configuration: typing.Optional[schemas.Configuration] = None, + **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], + ) -> 'multipart_form_data': + return super().__new__( + cls, + *args, + someProp=someProp, + _configuration=_configuration, + **kwargs, + ) + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + 'multipart/form-data': api_client.MediaType( + schema=Schemas.multipart_form_data + ), + }, + ) +_all_accept_content_types = ( + 'application/json', + 'multipart/form-data', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _inline_composition_oapg( + self, + content_type: typing_extensions.Literal["application/json"] = ..., + body: typing.Union[RequestBody.Schemas.application_json, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _inline_composition_oapg( + self, + content_type: typing_extensions.Literal["multipart/form-data"], + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _inline_composition_oapg( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _inline_composition_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _inline_composition_oapg( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _inline_composition_oapg( + self, + content_type: str = 'application/json', + body: typing.Union[RequestBody.Schemas.application_json, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + testing composed schemas at inline locations + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + self._verify_typed_dict_inputs_oapg(RequestQueryParameters.Params, query_params) + used_path = path.value + + prefix_separator_iterator = None + for parameter in RequestQueryParameters.parameters: + parameter_data = query_params.get(parameter.name, schemas.unset) + if parameter_data is schemas.unset: + continue + if prefix_separator_iterator is None: + prefix_separator_iterator = parameter.get_prefix_separator_iterator() + serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) + for serialized_value in serialized_data.values(): + used_path += serialized_value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + _fields = None + _body = None + if body is not schemas.unset: + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class InlineComposition(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def inline_composition( + self, + content_type: typing_extensions.Literal["application/json"] = ..., + body: typing.Union[RequestBody.Schemas.application_json, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def inline_composition( + self, + content_type: typing_extensions.Literal["multipart/form-data"], + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def inline_composition( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def inline_composition( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def inline_composition( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def inline_composition( + self, + content_type: str = 'application/json', + body: typing.Union[RequestBody.Schemas.application_json, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._inline_composition_oapg( + body=body, + query_params=query_params, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + content_type: typing_extensions.Literal["application/json"] = ..., + body: typing.Union[RequestBody.Schemas.application_json, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + content_type: typing_extensions.Literal["multipart/form-data"], + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + content_type: str = 'application/json', + body: typing.Union[RequestBody.Schemas.application_json, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._inline_composition_oapg( + body=body, + query_params=query_params, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_inline_composition_/post/response_for_200.py b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_inline_composition_/post/response_for_200.py new file mode 100644 index 00000000000..73ccd674578 --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_inline_composition_/post/response_for_200.py @@ -0,0 +1,183 @@ +import dataclasses +import urllib3 + +from petstore_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + + +class BodySchemas: + # body schemas + + + class application_json( + schemas.ComposedSchema, + ): + + + class MetaOapg: + + + class all_of_0( + schemas.StrSchema + ): + + + class MetaOapg: + min_length = 1 + + @classmethod + @functools.lru_cache() + def all_of(cls): + # we need this here to make our import statements work + # we must store _composed_schemas in here so the code is only run + # when we invoke this method. If we kept this at the class + # level we would get an error because the class level + # code would be run when this module is imported, and these composed + # classes don't exist yet because their module has not finished + # loading + return [ + cls.all_of_0, + ] + + + def __new__( + cls, + *args: typing.Union[dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], + _configuration: typing.Optional[schemas.Configuration] = None, + **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], + ) -> 'application_json': + return super().__new__( + cls, + *args, + _configuration=_configuration, + **kwargs, + ) + + + class multipart_form_data( + schemas.DictSchema + ): + + + class MetaOapg: + + class properties: + + + class someProp( + schemas.ComposedSchema, + ): + + + class MetaOapg: + + + class all_of_0( + schemas.StrSchema + ): + + + class MetaOapg: + min_length = 1 + + @classmethod + @functools.lru_cache() + def all_of(cls): + # we need this here to make our import statements work + # we must store _composed_schemas in here so the code is only run + # when we invoke this method. If we kept this at the class + # level we would get an error because the class level + # code would be run when this module is imported, and these composed + # classes don't exist yet because their module has not finished + # loading + return [ + cls.all_of_0, + ] + + + def __new__( + cls, + *args: typing.Union[dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], + _configuration: typing.Optional[schemas.Configuration] = None, + **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], + ) -> 'someProp': + return super().__new__( + cls, + *args, + _configuration=_configuration, + **kwargs, + ) + __annotations__ = { + "someProp": someProp, + } + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["someProp"]) -> MetaOapg.properties.someProp: ... + + @typing.overload + def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... + + def __getitem__(self, name: typing.Union[typing_extensions.Literal["someProp", ], str]): + # dict_instance[name] accessor + return super().__getitem__(name) + + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["someProp"]) -> typing.Union[MetaOapg.properties.someProp, schemas.Unset]: ... + + @typing.overload + def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... + + def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["someProp", ], str]): + return super().get_item_oapg(name) + + + def __new__( + cls, + *args: typing.Union[dict, frozendict.frozendict, ], + someProp: typing.Union[MetaOapg.properties.someProp, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, + _configuration: typing.Optional[schemas.Configuration] = None, + **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], + ) -> 'multipart_form_data': + return super().__new__( + cls, + *args, + someProp=someProp, + _configuration=_configuration, + **kwargs, + ) + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_json, + BodySchemas.multipart_form_data, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + 'multipart/form-data': api_client.MediaType( + schema=BodySchemas.multipart_form_data, + ), + }, +) diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_json_form_data/get.py b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_json_form_data/get.py deleted file mode 100644 index 262f5e3a77a..00000000000 --- a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_json_form_data/get.py +++ /dev/null @@ -1,360 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from petstore_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from petstore_api import schemas # noqa: F401 - -from . import path - -# body param - - -class SchemaForRequestBodyApplicationXWwwFormUrlencoded( - schemas.DictSchema -): - - - class MetaOapg: - required = { - "param", - "param2", - } - - class properties: - param = schemas.StrSchema - param2 = schemas.StrSchema - __annotations__ = { - "param": param, - "param2": param2, - } - - param: MetaOapg.properties.param - param2: MetaOapg.properties.param2 - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["param"]) -> MetaOapg.properties.param: ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["param2"]) -> MetaOapg.properties.param2: ... - - @typing.overload - def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... - - def __getitem__(self, name: typing.Union[typing_extensions.Literal["param", "param2", ], str]): - # dict_instance[name] accessor - return super().__getitem__(name) - - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["param"]) -> MetaOapg.properties.param: ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["param2"]) -> MetaOapg.properties.param2: ... - - @typing.overload - def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... - - def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["param", "param2", ], str]): - return super().get_item_oapg(name) - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, ], - param: typing.Union[MetaOapg.properties.param, str, ], - param2: typing.Union[MetaOapg.properties.param2, str, ], - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'SchemaForRequestBodyApplicationXWwwFormUrlencoded': - return super().__new__( - cls, - *args, - param=param, - param2=param2, - _configuration=_configuration, - **kwargs, - ) - - -request_body_body = api_client.RequestBody( - content={ - 'application/x-www-form-urlencoded': api_client.MediaType( - schema=SchemaForRequestBodyApplicationXWwwFormUrlencoded), - }, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) -_status_code_to_response = { - '200': _response_for_200, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _json_form_data_oapg( - self, - content_type: typing_extensions.Literal["application/x-www-form-urlencoded"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _json_form_data_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _json_form_data_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _json_form_data_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _json_form_data_oapg( - self, - content_type: str = 'application/x-www-form-urlencoded', - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - test json serialization of form data - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - _fields = None - _body = None - if body is not schemas.unset: - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='get'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class JsonFormData(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def json_form_data( - self, - content_type: typing_extensions.Literal["application/x-www-form-urlencoded"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def json_form_data( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def json_form_data( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def json_form_data( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def json_form_data( - self, - content_type: str = 'application/x-www-form-urlencoded', - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._json_form_data_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForget(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def get( - self, - content_type: typing_extensions.Literal["application/x-www-form-urlencoded"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def get( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def get( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get( - self, - content_type: str = 'application/x-www-form-urlencoded', - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._json_form_data_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_json_form_data/get.pyi b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_json_form_data/get.pyi deleted file mode 100644 index e1ce6578278..00000000000 --- a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_json_form_data/get.pyi +++ /dev/null @@ -1,355 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from petstore_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from petstore_api import schemas # noqa: F401 - -# body param - - -class SchemaForRequestBodyApplicationXWwwFormUrlencoded( - schemas.DictSchema -): - - - class MetaOapg: - required = { - "param", - "param2", - } - - class properties: - param = schemas.StrSchema - param2 = schemas.StrSchema - __annotations__ = { - "param": param, - "param2": param2, - } - - param: MetaOapg.properties.param - param2: MetaOapg.properties.param2 - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["param"]) -> MetaOapg.properties.param: ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["param2"]) -> MetaOapg.properties.param2: ... - - @typing.overload - def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... - - def __getitem__(self, name: typing.Union[typing_extensions.Literal["param", "param2", ], str]): - # dict_instance[name] accessor - return super().__getitem__(name) - - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["param"]) -> MetaOapg.properties.param: ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["param2"]) -> MetaOapg.properties.param2: ... - - @typing.overload - def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... - - def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["param", "param2", ], str]): - return super().get_item_oapg(name) - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, ], - param: typing.Union[MetaOapg.properties.param, str, ], - param2: typing.Union[MetaOapg.properties.param2, str, ], - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'SchemaForRequestBodyApplicationXWwwFormUrlencoded': - return super().__new__( - cls, - *args, - param=param, - param2=param2, - _configuration=_configuration, - **kwargs, - ) - - -request_body_body = api_client.RequestBody( - content={ - 'application/x-www-form-urlencoded': api_client.MediaType( - schema=SchemaForRequestBodyApplicationXWwwFormUrlencoded), - }, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _json_form_data_oapg( - self, - content_type: typing_extensions.Literal["application/x-www-form-urlencoded"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _json_form_data_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _json_form_data_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _json_form_data_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _json_form_data_oapg( - self, - content_type: str = 'application/x-www-form-urlencoded', - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - test json serialization of form data - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - _fields = None - _body = None - if body is not schemas.unset: - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='get'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class JsonFormData(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def json_form_data( - self, - content_type: typing_extensions.Literal["application/x-www-form-urlencoded"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def json_form_data( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def json_form_data( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def json_form_data( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def json_form_data( - self, - content_type: str = 'application/x-www-form-urlencoded', - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._json_form_data_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForget(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def get( - self, - content_type: typing_extensions.Literal["application/x-www-form-urlencoded"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def get( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def get( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get( - self, - content_type: str = 'application/x-www-form-urlencoded', - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._json_form_data_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_json_form_data/get/__init__.py b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_json_form_data/get/__init__.py new file mode 100644 index 00000000000..ca1b716630b --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_json_form_data/get/__init__.py @@ -0,0 +1,353 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 + + + +class RequestBody: + class Schemas: + + + class application_x_www_form_urlencoded( + schemas.DictSchema + ): + + + class MetaOapg: + required = { + "param", + "param2", + } + + class properties: + param = schemas.StrSchema + param2 = schemas.StrSchema + __annotations__ = { + "param": param, + "param2": param2, + } + + param: MetaOapg.properties.param + param2: MetaOapg.properties.param2 + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["param"]) -> MetaOapg.properties.param: ... + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["param2"]) -> MetaOapg.properties.param2: ... + + @typing.overload + def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... + + def __getitem__(self, name: typing.Union[typing_extensions.Literal["param", "param2", ], str]): + # dict_instance[name] accessor + return super().__getitem__(name) + + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["param"]) -> MetaOapg.properties.param: ... + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["param2"]) -> MetaOapg.properties.param2: ... + + @typing.overload + def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... + + def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["param", "param2", ], str]): + return super().get_item_oapg(name) + + + def __new__( + cls, + *args: typing.Union[dict, frozendict.frozendict, ], + param: typing.Union[MetaOapg.properties.param, str, ], + param2: typing.Union[MetaOapg.properties.param2, str, ], + _configuration: typing.Optional[schemas.Configuration] = None, + **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], + ) -> 'application_x_www_form_urlencoded': + return super().__new__( + cls, + *args, + param=param, + param2=param2, + _configuration=_configuration, + **kwargs, + ) + + parameter = api_client.RequestBody( + content={ + 'application/x-www-form-urlencoded': api_client.MediaType( + schema=Schemas.application_x_www_form_urlencoded + ), + }, + ) + +_status_code_to_response = { + '200': response_for_200.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _json_form_data_oapg( + self, + content_type: typing_extensions.Literal["application/x-www-form-urlencoded"] = ..., + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _json_form_data_oapg( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _json_form_data_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _json_form_data_oapg( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _json_form_data_oapg( + self, + content_type: str = 'application/x-www-form-urlencoded', + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + test json serialization of form data + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + _fields = None + _body = None + if body is not schemas.unset: + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='get'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class JsonFormData(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def json_form_data( + self, + content_type: typing_extensions.Literal["application/x-www-form-urlencoded"] = ..., + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def json_form_data( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def json_form_data( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def json_form_data( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def json_form_data( + self, + content_type: str = 'application/x-www-form-urlencoded', + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._json_form_data_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForget(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def get( + self, + content_type: typing_extensions.Literal["application/x-www-form-urlencoded"] = ..., + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def get( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def get( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def get( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def get( + self, + content_type: str = 'application/x-www-form-urlencoded', + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._json_form_data_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_json_form_data/get/__init__.pyi b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_json_form_data/get/__init__.pyi new file mode 100644 index 00000000000..0e2ecdb4462 --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_json_form_data/get/__init__.pyi @@ -0,0 +1,348 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from . import response_for_200 + + + +class RequestBody: + class Schemas: + + + class application_x_www_form_urlencoded( + schemas.DictSchema + ): + + + class MetaOapg: + required = { + "param", + "param2", + } + + class properties: + param = schemas.StrSchema + param2 = schemas.StrSchema + __annotations__ = { + "param": param, + "param2": param2, + } + + param: MetaOapg.properties.param + param2: MetaOapg.properties.param2 + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["param"]) -> MetaOapg.properties.param: ... + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["param2"]) -> MetaOapg.properties.param2: ... + + @typing.overload + def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... + + def __getitem__(self, name: typing.Union[typing_extensions.Literal["param", "param2", ], str]): + # dict_instance[name] accessor + return super().__getitem__(name) + + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["param"]) -> MetaOapg.properties.param: ... + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["param2"]) -> MetaOapg.properties.param2: ... + + @typing.overload + def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... + + def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["param", "param2", ], str]): + return super().get_item_oapg(name) + + + def __new__( + cls, + *args: typing.Union[dict, frozendict.frozendict, ], + param: typing.Union[MetaOapg.properties.param, str, ], + param2: typing.Union[MetaOapg.properties.param2, str, ], + _configuration: typing.Optional[schemas.Configuration] = None, + **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], + ) -> 'application_x_www_form_urlencoded': + return super().__new__( + cls, + *args, + param=param, + param2=param2, + _configuration=_configuration, + **kwargs, + ) + + parameter = api_client.RequestBody( + content={ + 'application/x-www-form-urlencoded': api_client.MediaType( + schema=Schemas.application_x_www_form_urlencoded + ), + }, + ) + + +class BaseApi(api_client.Api): + @typing.overload + def _json_form_data_oapg( + self, + content_type: typing_extensions.Literal["application/x-www-form-urlencoded"] = ..., + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _json_form_data_oapg( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _json_form_data_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _json_form_data_oapg( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _json_form_data_oapg( + self, + content_type: str = 'application/x-www-form-urlencoded', + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + test json serialization of form data + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + _fields = None + _body = None + if body is not schemas.unset: + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='get'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class JsonFormData(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def json_form_data( + self, + content_type: typing_extensions.Literal["application/x-www-form-urlencoded"] = ..., + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def json_form_data( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def json_form_data( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def json_form_data( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def json_form_data( + self, + content_type: str = 'application/x-www-form-urlencoded', + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._json_form_data_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForget(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def get( + self, + content_type: typing_extensions.Literal["application/x-www-form-urlencoded"] = ..., + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def get( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def get( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def get( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def get( + self, + content_type: str = 'application/x-www-form-urlencoded', + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._json_form_data_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_json_form_data/get/response_for_200.py b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_json_form_data/get/response_for_200.py new file mode 100644 index 00000000000..7ec95a8627a --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_json_form_data/get/response_for_200.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from petstore_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_json_patch/patch.py b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_json_patch/patch.py deleted file mode 100644 index d55867cd112..00000000000 --- a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_json_patch/patch.py +++ /dev/null @@ -1,296 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from petstore_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from petstore_api import schemas # noqa: F401 - -from petstore_api.model.json_patch_request import JSONPatchRequest - -from . import path - -# body param -SchemaForRequestBodyApplicationJsonPatchjson = JSONPatchRequest - - -request_body_json_patch_request = api_client.RequestBody( - content={ - 'application/json-patch+json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJsonPatchjson), - }, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) -_status_code_to_response = { - '200': _response_for_200, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _json_patch_oapg( - self, - content_type: typing_extensions.Literal["application/json-patch+json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJsonPatchjson, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _json_patch_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJsonPatchjson, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _json_patch_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJsonPatchjson, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _json_patch_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJsonPatchjson, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _json_patch_oapg( - self, - content_type: str = 'application/json-patch+json', - body: typing.Union[SchemaForRequestBodyApplicationJsonPatchjson, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - json patch - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - _fields = None - _body = None - if body is not schemas.unset: - serialized_data = request_body_json_patch_request.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='patch'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class JsonPatch(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def json_patch( - self, - content_type: typing_extensions.Literal["application/json-patch+json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJsonPatchjson, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def json_patch( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJsonPatchjson, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def json_patch( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJsonPatchjson, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def json_patch( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJsonPatchjson, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def json_patch( - self, - content_type: str = 'application/json-patch+json', - body: typing.Union[SchemaForRequestBodyApplicationJsonPatchjson, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._json_patch_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpatch(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def patch( - self, - content_type: typing_extensions.Literal["application/json-patch+json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJsonPatchjson, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def patch( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJsonPatchjson, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def patch( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJsonPatchjson, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def patch( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJsonPatchjson, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def patch( - self, - content_type: str = 'application/json-patch+json', - body: typing.Union[SchemaForRequestBodyApplicationJsonPatchjson, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._json_patch_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_json_patch/patch.pyi b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_json_patch/patch.pyi deleted file mode 100644 index 3322e593ccd..00000000000 --- a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_json_patch/patch.pyi +++ /dev/null @@ -1,291 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from petstore_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from petstore_api import schemas # noqa: F401 - -from petstore_api.model.json_patch_request import JSONPatchRequest - -# body param -SchemaForRequestBodyApplicationJsonPatchjson = JSONPatchRequest - - -request_body_json_patch_request = api_client.RequestBody( - content={ - 'application/json-patch+json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJsonPatchjson), - }, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _json_patch_oapg( - self, - content_type: typing_extensions.Literal["application/json-patch+json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJsonPatchjson, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _json_patch_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJsonPatchjson, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _json_patch_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJsonPatchjson, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _json_patch_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJsonPatchjson, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _json_patch_oapg( - self, - content_type: str = 'application/json-patch+json', - body: typing.Union[SchemaForRequestBodyApplicationJsonPatchjson, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - json patch - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - _fields = None - _body = None - if body is not schemas.unset: - serialized_data = request_body_json_patch_request.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='patch'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class JsonPatch(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def json_patch( - self, - content_type: typing_extensions.Literal["application/json-patch+json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJsonPatchjson, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def json_patch( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJsonPatchjson, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def json_patch( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJsonPatchjson, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def json_patch( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJsonPatchjson, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def json_patch( - self, - content_type: str = 'application/json-patch+json', - body: typing.Union[SchemaForRequestBodyApplicationJsonPatchjson, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._json_patch_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpatch(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def patch( - self, - content_type: typing_extensions.Literal["application/json-patch+json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJsonPatchjson, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def patch( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJsonPatchjson, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def patch( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJsonPatchjson, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def patch( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJsonPatchjson, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def patch( - self, - content_type: str = 'application/json-patch+json', - body: typing.Union[SchemaForRequestBodyApplicationJsonPatchjson, schemas.Unset] = schemas.unset, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._json_patch_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_json_patch/patch/__init__.py b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_json_patch/patch/__init__.py new file mode 100644 index 00000000000..b653e5f7946 --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_json_patch/patch/__init__.py @@ -0,0 +1,289 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from petstore_api.model.json_patch_request import JSONPatchRequest + +from .. import path +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json_patchjson = JSONPatchRequest + + parameter = api_client.RequestBody( + content={ + 'application/json-patch+json': api_client.MediaType( + schema=Schemas.application_json_patchjson + ), + }, + ) + +_status_code_to_response = { + '200': response_for_200.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _json_patch_oapg( + self, + content_type: typing_extensions.Literal["application/json-patch+json"] = ..., + body: typing.Union[RequestBody.Schemas.application_json_patchjson, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _json_patch_oapg( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json_patchjson, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _json_patch_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json_patchjson, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _json_patch_oapg( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json_patchjson, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _json_patch_oapg( + self, + content_type: str = 'application/json-patch+json', + body: typing.Union[RequestBody.Schemas.application_json_patchjson, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + json patch + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + _fields = None + _body = None + if body is not schemas.unset: + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='patch'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class JsonPatch(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def json_patch( + self, + content_type: typing_extensions.Literal["application/json-patch+json"] = ..., + body: typing.Union[RequestBody.Schemas.application_json_patchjson, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def json_patch( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json_patchjson, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def json_patch( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json_patchjson, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def json_patch( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json_patchjson, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def json_patch( + self, + content_type: str = 'application/json-patch+json', + body: typing.Union[RequestBody.Schemas.application_json_patchjson, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._json_patch_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpatch(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def patch( + self, + content_type: typing_extensions.Literal["application/json-patch+json"] = ..., + body: typing.Union[RequestBody.Schemas.application_json_patchjson, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def patch( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json_patchjson, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def patch( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json_patchjson, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def patch( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json_patchjson, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def patch( + self, + content_type: str = 'application/json-patch+json', + body: typing.Union[RequestBody.Schemas.application_json_patchjson, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._json_patch_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_json_patch/patch/__init__.pyi b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_json_patch/patch/__init__.pyi new file mode 100644 index 00000000000..2c41d512575 --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_json_patch/patch/__init__.pyi @@ -0,0 +1,284 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from petstore_api.model.json_patch_request import JSONPatchRequest + +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json_patchjson = JSONPatchRequest + + parameter = api_client.RequestBody( + content={ + 'application/json-patch+json': api_client.MediaType( + schema=Schemas.application_json_patchjson + ), + }, + ) + + +class BaseApi(api_client.Api): + @typing.overload + def _json_patch_oapg( + self, + content_type: typing_extensions.Literal["application/json-patch+json"] = ..., + body: typing.Union[RequestBody.Schemas.application_json_patchjson, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _json_patch_oapg( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json_patchjson, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _json_patch_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json_patchjson, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _json_patch_oapg( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json_patchjson, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _json_patch_oapg( + self, + content_type: str = 'application/json-patch+json', + body: typing.Union[RequestBody.Schemas.application_json_patchjson, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + json patch + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + _fields = None + _body = None + if body is not schemas.unset: + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='patch'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class JsonPatch(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def json_patch( + self, + content_type: typing_extensions.Literal["application/json-patch+json"] = ..., + body: typing.Union[RequestBody.Schemas.application_json_patchjson, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def json_patch( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json_patchjson, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def json_patch( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json_patchjson, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def json_patch( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json_patchjson, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def json_patch( + self, + content_type: str = 'application/json-patch+json', + body: typing.Union[RequestBody.Schemas.application_json_patchjson, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._json_patch_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpatch(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def patch( + self, + content_type: typing_extensions.Literal["application/json-patch+json"] = ..., + body: typing.Union[RequestBody.Schemas.application_json_patchjson, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def patch( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json_patchjson, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def patch( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json_patchjson, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def patch( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json_patchjson, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def patch( + self, + content_type: str = 'application/json-patch+json', + body: typing.Union[RequestBody.Schemas.application_json_patchjson, schemas.Unset] = schemas.unset, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._json_patch_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_json_patch/patch/response_for_200.py b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_json_patch/patch/response_for_200.py new file mode 100644 index 00000000000..7ec95a8627a --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_json_patch/patch/response_for_200.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from petstore_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_json_with_charset/post.py b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_json_with_charset/post.py deleted file mode 100644 index 7e075373a3e..00000000000 --- a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_json_with_charset/post.py +++ /dev/null @@ -1,324 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from petstore_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from petstore_api import schemas # noqa: F401 - -from . import path - -# body param -SchemaForRequestBodyApplicationJsonCharsetutf8 = schemas.AnyTypeSchema - - -request_body_body = api_client.RequestBody( - content={ - 'application/json; charset=utf-8': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJsonCharsetutf8), - }, -) -SchemaFor200ResponseBodyApplicationJsonCharsetutf8 = schemas.AnyTypeSchema - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJsonCharsetutf8, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json; charset=utf-8': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJsonCharsetutf8), - }, -) -_status_code_to_response = { - '200': _response_for_200, -} -_all_accept_content_types = ( - 'application/json; charset=utf-8', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _json_with_charset_oapg( - self, - content_type: typing_extensions.Literal["application/json; charset=utf-8"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJsonCharsetutf8, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _json_with_charset_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJsonCharsetutf8, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _json_with_charset_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJsonCharsetutf8, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _json_with_charset_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJsonCharsetutf8, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _json_with_charset_oapg( - self, - content_type: str = 'application/json; charset=utf-8', - body: typing.Union[SchemaForRequestBodyApplicationJsonCharsetutf8, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - json with charset tx and rx - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - _fields = None - _body = None - if body is not schemas.unset: - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class JsonWithCharset(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def json_with_charset( - self, - content_type: typing_extensions.Literal["application/json; charset=utf-8"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJsonCharsetutf8, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def json_with_charset( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJsonCharsetutf8, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def json_with_charset( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJsonCharsetutf8, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def json_with_charset( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJsonCharsetutf8, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def json_with_charset( - self, - content_type: str = 'application/json; charset=utf-8', - body: typing.Union[SchemaForRequestBodyApplicationJsonCharsetutf8, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._json_with_charset_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - content_type: typing_extensions.Literal["application/json; charset=utf-8"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJsonCharsetutf8, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJsonCharsetutf8, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJsonCharsetutf8, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJsonCharsetutf8, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - content_type: str = 'application/json; charset=utf-8', - body: typing.Union[SchemaForRequestBodyApplicationJsonCharsetutf8, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._json_with_charset_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_json_with_charset/post.pyi b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_json_with_charset/post.pyi deleted file mode 100644 index 5246ee555a8..00000000000 --- a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_json_with_charset/post.pyi +++ /dev/null @@ -1,319 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from petstore_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from petstore_api import schemas # noqa: F401 - -# body param -SchemaForRequestBodyApplicationJsonCharsetutf8 = schemas.AnyTypeSchema - - -request_body_body = api_client.RequestBody( - content={ - 'application/json; charset=utf-8': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJsonCharsetutf8), - }, -) -SchemaFor200ResponseBodyApplicationJsonCharsetutf8 = schemas.AnyTypeSchema - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJsonCharsetutf8, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json; charset=utf-8': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJsonCharsetutf8), - }, -) -_all_accept_content_types = ( - 'application/json; charset=utf-8', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _json_with_charset_oapg( - self, - content_type: typing_extensions.Literal["application/json; charset=utf-8"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJsonCharsetutf8, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _json_with_charset_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJsonCharsetutf8, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _json_with_charset_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJsonCharsetutf8, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _json_with_charset_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJsonCharsetutf8, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _json_with_charset_oapg( - self, - content_type: str = 'application/json; charset=utf-8', - body: typing.Union[SchemaForRequestBodyApplicationJsonCharsetutf8, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - json with charset tx and rx - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - _fields = None - _body = None - if body is not schemas.unset: - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class JsonWithCharset(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def json_with_charset( - self, - content_type: typing_extensions.Literal["application/json; charset=utf-8"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJsonCharsetutf8, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def json_with_charset( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJsonCharsetutf8, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def json_with_charset( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJsonCharsetutf8, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def json_with_charset( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJsonCharsetutf8, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def json_with_charset( - self, - content_type: str = 'application/json; charset=utf-8', - body: typing.Union[SchemaForRequestBodyApplicationJsonCharsetutf8, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._json_with_charset_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - content_type: typing_extensions.Literal["application/json; charset=utf-8"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJsonCharsetutf8, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJsonCharsetutf8, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJsonCharsetutf8, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJsonCharsetutf8, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - content_type: str = 'application/json; charset=utf-8', - body: typing.Union[SchemaForRequestBodyApplicationJsonCharsetutf8, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._json_with_charset_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_json_with_charset/post/__init__.py b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_json_with_charset/post/__init__.py new file mode 100644 index 00000000000..26d8b9a3062 --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_json_with_charset/post/__init__.py @@ -0,0 +1,310 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json_charsetutf_8 = schemas.AnyTypeSchema + + parameter = api_client.RequestBody( + content={ + 'application/json; charset=utf-8': api_client.MediaType( + schema=Schemas.application_json_charsetutf_8 + ), + }, + ) + +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/json; charset=utf-8', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _json_with_charset_oapg( + self, + content_type: typing_extensions.Literal["application/json; charset=utf-8"] = ..., + body: typing.Union[RequestBody.Schemas.application_json_charsetutf_8, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _json_with_charset_oapg( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json_charsetutf_8, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _json_with_charset_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json_charsetutf_8, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _json_with_charset_oapg( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json_charsetutf_8, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _json_with_charset_oapg( + self, + content_type: str = 'application/json; charset=utf-8', + body: typing.Union[RequestBody.Schemas.application_json_charsetutf_8, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + json with charset tx and rx + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + _fields = None + _body = None + if body is not schemas.unset: + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class JsonWithCharset(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def json_with_charset( + self, + content_type: typing_extensions.Literal["application/json; charset=utf-8"] = ..., + body: typing.Union[RequestBody.Schemas.application_json_charsetutf_8, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def json_with_charset( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json_charsetutf_8, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def json_with_charset( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json_charsetutf_8, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def json_with_charset( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json_charsetutf_8, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def json_with_charset( + self, + content_type: str = 'application/json; charset=utf-8', + body: typing.Union[RequestBody.Schemas.application_json_charsetutf_8, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._json_with_charset_oapg( + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + content_type: typing_extensions.Literal["application/json; charset=utf-8"] = ..., + body: typing.Union[RequestBody.Schemas.application_json_charsetutf_8, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json_charsetutf_8, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json_charsetutf_8, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json_charsetutf_8, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + content_type: str = 'application/json; charset=utf-8', + body: typing.Union[RequestBody.Schemas.application_json_charsetutf_8, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._json_with_charset_oapg( + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_json_with_charset/post/__init__.pyi b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_json_with_charset/post/__init__.pyi new file mode 100644 index 00000000000..0721d26e50d --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_json_with_charset/post/__init__.pyi @@ -0,0 +1,305 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json_charsetutf_8 = schemas.AnyTypeSchema + + parameter = api_client.RequestBody( + content={ + 'application/json; charset=utf-8': api_client.MediaType( + schema=Schemas.application_json_charsetutf_8 + ), + }, + ) +_all_accept_content_types = ( + 'application/json; charset=utf-8', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _json_with_charset_oapg( + self, + content_type: typing_extensions.Literal["application/json; charset=utf-8"] = ..., + body: typing.Union[RequestBody.Schemas.application_json_charsetutf_8, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _json_with_charset_oapg( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json_charsetutf_8, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _json_with_charset_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json_charsetutf_8, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _json_with_charset_oapg( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json_charsetutf_8, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _json_with_charset_oapg( + self, + content_type: str = 'application/json; charset=utf-8', + body: typing.Union[RequestBody.Schemas.application_json_charsetutf_8, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + json with charset tx and rx + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + _fields = None + _body = None + if body is not schemas.unset: + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class JsonWithCharset(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def json_with_charset( + self, + content_type: typing_extensions.Literal["application/json; charset=utf-8"] = ..., + body: typing.Union[RequestBody.Schemas.application_json_charsetutf_8, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def json_with_charset( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json_charsetutf_8, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def json_with_charset( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json_charsetutf_8, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def json_with_charset( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json_charsetutf_8, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def json_with_charset( + self, + content_type: str = 'application/json; charset=utf-8', + body: typing.Union[RequestBody.Schemas.application_json_charsetutf_8, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._json_with_charset_oapg( + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + content_type: typing_extensions.Literal["application/json; charset=utf-8"] = ..., + body: typing.Union[RequestBody.Schemas.application_json_charsetutf_8, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json_charsetutf_8, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json_charsetutf_8, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json_charsetutf_8, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + content_type: str = 'application/json; charset=utf-8', + body: typing.Union[RequestBody.Schemas.application_json_charsetutf_8, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._json_with_charset_oapg( + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_json_with_charset/post/response_for_200.py b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_json_with_charset/post/response_for_200.py new file mode 100644 index 00000000000..7c80211b70e --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_json_with_charset/post/response_for_200.py @@ -0,0 +1,41 @@ +import dataclasses +import urllib3 + +from petstore_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + + +class BodySchemas: + # body schemas + application_json_charsetutf_8 = schemas.AnyTypeSchema + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_json_charsetutf_8, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json; charset=utf-8': api_client.MediaType( + schema=BodySchemas.application_json_charsetutf_8, + ), + }, +) diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_obj_in_query/get/__init__.py b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_obj_in_query/get/__init__.py new file mode 100644 index 00000000000..28dcbfceb2a --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_obj_in_query/get/__init__.py @@ -0,0 +1,299 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 + + + +class RequestQueryParameters: + class Schemas: + + + class mapBean( + schemas.DictSchema + ): + + + class MetaOapg: + + class properties: + keyword = schemas.StrSchema + __annotations__ = { + "keyword": keyword, + } + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["keyword"]) -> MetaOapg.properties.keyword: ... + + @typing.overload + def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... + + def __getitem__(self, name: typing.Union[typing_extensions.Literal["keyword", ], str]): + # dict_instance[name] accessor + return super().__getitem__(name) + + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["keyword"]) -> typing.Union[MetaOapg.properties.keyword, schemas.Unset]: ... + + @typing.overload + def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... + + def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["keyword", ], str]): + return super().get_item_oapg(name) + + + def __new__( + cls, + *args: typing.Union[dict, frozendict.frozendict, ], + keyword: typing.Union[MetaOapg.properties.keyword, str, schemas.Unset] = schemas.unset, + _configuration: typing.Optional[schemas.Configuration] = None, + **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], + ) -> 'mapBean': + return super().__new__( + cls, + *args, + keyword=keyword, + _configuration=_configuration, + **kwargs, + ) + + + RequiredParams = typing_extensions.TypedDict( + 'RequiredParams', + { + } + ) + OptionalParams = typing_extensions.TypedDict( + 'OptionalParams', + { + 'mapBean': typing.Union[Schemas.mapBean, dict, frozendict.frozendict, ], + }, + total=False + ) + + + class Params(RequiredParams, OptionalParams): + pass + + + parameters = [ + api_client.QueryParameter( + name="mapBean", + style=api_client.ParameterStyle.DEEP_OBJECT, + schema=Schemas.mapBean, + explode=True, + ), + ] +_status_code_to_response = { + '200': response_for_200.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _object_in_query_oapg( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _object_in_query_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _object_in_query_oapg( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _object_in_query_oapg( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + user list + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + self._verify_typed_dict_inputs_oapg(RequestQueryParameters.Params, query_params) + used_path = path.value + + prefix_separator_iterator = None + for parameter in RequestQueryParameters.parameters: + parameter_data = query_params.get(parameter.name, schemas.unset) + if parameter_data is schemas.unset: + continue + if prefix_separator_iterator is None: + prefix_separator_iterator = parameter.get_prefix_separator_iterator() + serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) + for serialized_value in serialized_data.values(): + used_path += serialized_value + # TODO add cookie handling + + response = self.api_client.call_api( + resource_path=used_path, + method='get'.upper(), + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class ObjectInQuery(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def object_in_query( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def object_in_query( + self, + skip_deserialization: typing_extensions.Literal[True], + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def object_in_query( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def object_in_query( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._object_in_query_oapg( + query_params=query_params, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForget(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def get( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def get( + self, + skip_deserialization: typing_extensions.Literal[True], + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def get( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def get( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._object_in_query_oapg( + query_params=query_params, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_obj_in_query/get/__init__.pyi b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_obj_in_query/get/__init__.pyi new file mode 100644 index 00000000000..060db024e93 --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_obj_in_query/get/__init__.pyi @@ -0,0 +1,294 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from . import response_for_200 + + + +class RequestQueryParameters: + class Schemas: + + + class mapBean( + schemas.DictSchema + ): + + + class MetaOapg: + + class properties: + keyword = schemas.StrSchema + __annotations__ = { + "keyword": keyword, + } + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["keyword"]) -> MetaOapg.properties.keyword: ... + + @typing.overload + def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... + + def __getitem__(self, name: typing.Union[typing_extensions.Literal["keyword", ], str]): + # dict_instance[name] accessor + return super().__getitem__(name) + + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["keyword"]) -> typing.Union[MetaOapg.properties.keyword, schemas.Unset]: ... + + @typing.overload + def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... + + def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["keyword", ], str]): + return super().get_item_oapg(name) + + + def __new__( + cls, + *args: typing.Union[dict, frozendict.frozendict, ], + keyword: typing.Union[MetaOapg.properties.keyword, str, schemas.Unset] = schemas.unset, + _configuration: typing.Optional[schemas.Configuration] = None, + **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], + ) -> 'mapBean': + return super().__new__( + cls, + *args, + keyword=keyword, + _configuration=_configuration, + **kwargs, + ) + + + RequiredParams = typing_extensions.TypedDict( + 'RequiredParams', + { + } + ) + OptionalParams = typing_extensions.TypedDict( + 'OptionalParams', + { + 'mapBean': typing.Union[Schemas.mapBean, dict, frozendict.frozendict, ], + }, + total=False + ) + + + class Params(RequiredParams, OptionalParams): + pass + + + parameters = [ + api_client.QueryParameter( + name="mapBean", + style=api_client.ParameterStyle.DEEP_OBJECT, + schema=Schemas.mapBean, + explode=True, + ), + ] + +class BaseApi(api_client.Api): + @typing.overload + def _object_in_query_oapg( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _object_in_query_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _object_in_query_oapg( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _object_in_query_oapg( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + user list + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + self._verify_typed_dict_inputs_oapg(RequestQueryParameters.Params, query_params) + used_path = path.value + + prefix_separator_iterator = None + for parameter in RequestQueryParameters.parameters: + parameter_data = query_params.get(parameter.name, schemas.unset) + if parameter_data is schemas.unset: + continue + if prefix_separator_iterator is None: + prefix_separator_iterator = parameter.get_prefix_separator_iterator() + serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) + for serialized_value in serialized_data.values(): + used_path += serialized_value + # TODO add cookie handling + + response = self.api_client.call_api( + resource_path=used_path, + method='get'.upper(), + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class ObjectInQuery(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def object_in_query( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def object_in_query( + self, + skip_deserialization: typing_extensions.Literal[True], + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def object_in_query( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def object_in_query( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._object_in_query_oapg( + query_params=query_params, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForget(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def get( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def get( + self, + skip_deserialization: typing_extensions.Literal[True], + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def get( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def get( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._object_in_query_oapg( + query_params=query_params, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_obj_in_query/get/response_for_200.py b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_obj_in_query/get/response_for_200.py new file mode 100644 index 00000000000..7ec95a8627a --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_obj_in_query/get/response_for_200.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from petstore_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_parameter_collisions_1_a_b_ab_self_a_b_/post.py b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_parameter_collisions_1_a_b_ab_self_a_b_/post.py deleted file mode 100644 index 4f12ff8fadc..00000000000 --- a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_parameter_collisions_1_a_b_ab_self_a_b_/post.py +++ /dev/null @@ -1,661 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from petstore_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from petstore_api import schemas # noqa: F401 - -from . import path - -# Query params -Model1Schema = schemas.StrSchema -ABSchema = schemas.StrSchema -AbSchema = schemas.StrSchema -ModelSelfSchema = schemas.StrSchema -ABSchema = schemas.StrSchema -RequestRequiredQueryParams = typing_extensions.TypedDict( - 'RequestRequiredQueryParams', - { - } -) -RequestOptionalQueryParams = typing_extensions.TypedDict( - 'RequestOptionalQueryParams', - { - '1': typing.Union[Model1Schema, str, ], - 'aB': typing.Union[ABSchema, str, ], - 'Ab': typing.Union[AbSchema, str, ], - 'self': typing.Union[ModelSelfSchema, str, ], - 'A-B': typing.Union[ABSchema, str, ], - }, - total=False -) - - -class RequestQueryParams(RequestRequiredQueryParams, RequestOptionalQueryParams): - pass - - -request_query__1 = api_client.QueryParameter( - name="1", - style=api_client.ParameterStyle.FORM, - schema=Model1Schema, - explode=True, -) -request_query_a_b = api_client.QueryParameter( - name="aB", - style=api_client.ParameterStyle.FORM, - schema=ABSchema, - explode=True, -) -request_query_ab = api_client.QueryParameter( - name="Ab", - style=api_client.ParameterStyle.FORM, - schema=AbSchema, - explode=True, -) -request_query__self = api_client.QueryParameter( - name="self", - style=api_client.ParameterStyle.FORM, - schema=ModelSelfSchema, - explode=True, -) -request_query_a_b2 = api_client.QueryParameter( - name="A-B", - style=api_client.ParameterStyle.FORM, - schema=ABSchema, - explode=True, -) -# Header params -Model1Schema = schemas.StrSchema -ABSchema = schemas.StrSchema -ModelSelfSchema = schemas.StrSchema -ABSchema = schemas.StrSchema -RequestRequiredHeaderParams = typing_extensions.TypedDict( - 'RequestRequiredHeaderParams', - { - } -) -RequestOptionalHeaderParams = typing_extensions.TypedDict( - 'RequestOptionalHeaderParams', - { - '1': typing.Union[Model1Schema, str, ], - 'aB': typing.Union[ABSchema, str, ], - 'self': typing.Union[ModelSelfSchema, str, ], - 'A-B': typing.Union[ABSchema, str, ], - }, - total=False -) - - -class RequestHeaderParams(RequestRequiredHeaderParams, RequestOptionalHeaderParams): - pass - - -request_header__2 = api_client.HeaderParameter( - name="1", - style=api_client.ParameterStyle.SIMPLE, - schema=Model1Schema, -) -request_header_a_b3 = api_client.HeaderParameter( - name="aB", - style=api_client.ParameterStyle.SIMPLE, - schema=ABSchema, -) -request_header__self2 = api_client.HeaderParameter( - name="self", - style=api_client.ParameterStyle.SIMPLE, - schema=ModelSelfSchema, -) -request_header_a_b4 = api_client.HeaderParameter( - name="A-B", - style=api_client.ParameterStyle.SIMPLE, - schema=ABSchema, -) -# Path params -Model1Schema = schemas.StrSchema -ABSchema = schemas.StrSchema -AbSchema = schemas.StrSchema -ModelSelfSchema = schemas.StrSchema -ABSchema = schemas.StrSchema -RequestRequiredPathParams = typing_extensions.TypedDict( - 'RequestRequiredPathParams', - { - '1': typing.Union[Model1Schema, str, ], - 'aB': typing.Union[ABSchema, str, ], - 'Ab': typing.Union[AbSchema, str, ], - 'self': typing.Union[ModelSelfSchema, str, ], - 'A-B': typing.Union[ABSchema, str, ], - } -) -RequestOptionalPathParams = typing_extensions.TypedDict( - 'RequestOptionalPathParams', - { - }, - total=False -) - - -class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): - pass - - -request_path__3 = api_client.PathParameter( - name="1", - style=api_client.ParameterStyle.SIMPLE, - schema=Model1Schema, - required=True, -) -request_path_a_b5 = api_client.PathParameter( - name="aB", - style=api_client.ParameterStyle.SIMPLE, - schema=ABSchema, - required=True, -) -request_path_ab2 = api_client.PathParameter( - name="Ab", - style=api_client.ParameterStyle.SIMPLE, - schema=AbSchema, - required=True, -) -request_path__self3 = api_client.PathParameter( - name="self", - style=api_client.ParameterStyle.SIMPLE, - schema=ModelSelfSchema, - required=True, -) -request_path_a_b6 = api_client.PathParameter( - name="A-B", - style=api_client.ParameterStyle.SIMPLE, - schema=ABSchema, - required=True, -) -# Cookie params -Model1Schema = schemas.StrSchema -ABSchema = schemas.StrSchema -AbSchema = schemas.StrSchema -ModelSelfSchema = schemas.StrSchema -ABSchema = schemas.StrSchema -RequestRequiredCookieParams = typing_extensions.TypedDict( - 'RequestRequiredCookieParams', - { - } -) -RequestOptionalCookieParams = typing_extensions.TypedDict( - 'RequestOptionalCookieParams', - { - '1': typing.Union[Model1Schema, str, ], - 'aB': typing.Union[ABSchema, str, ], - 'Ab': typing.Union[AbSchema, str, ], - 'self': typing.Union[ModelSelfSchema, str, ], - 'A-B': typing.Union[ABSchema, str, ], - }, - total=False -) - - -class RequestCookieParams(RequestRequiredCookieParams, RequestOptionalCookieParams): - pass - - -request_cookie__4 = api_client.CookieParameter( - name="1", - style=api_client.ParameterStyle.FORM, - schema=Model1Schema, - explode=True, -) -request_cookie_a_b7 = api_client.CookieParameter( - name="aB", - style=api_client.ParameterStyle.FORM, - schema=ABSchema, - explode=True, -) -request_cookie_ab3 = api_client.CookieParameter( - name="Ab", - style=api_client.ParameterStyle.FORM, - schema=AbSchema, - explode=True, -) -request_cookie__self4 = api_client.CookieParameter( - name="self", - style=api_client.ParameterStyle.FORM, - schema=ModelSelfSchema, - explode=True, -) -request_cookie_a_b8 = api_client.CookieParameter( - name="A-B", - style=api_client.ParameterStyle.FORM, - schema=ABSchema, - explode=True, -) -# body param -SchemaForRequestBodyApplicationJson = schemas.AnyTypeSchema - - -request_body_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, -) -SchemaFor200ResponseBodyApplicationJson = schemas.AnyTypeSchema - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_status_code_to_response = { - '200': _response_for_200, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _parameter_collisions_oapg( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - query_params: RequestQueryParams = frozendict.frozendict(), - header_params: RequestHeaderParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - cookie_params: RequestCookieParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _parameter_collisions_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - query_params: RequestQueryParams = frozendict.frozendict(), - header_params: RequestHeaderParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - cookie_params: RequestCookieParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _parameter_collisions_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - query_params: RequestQueryParams = frozendict.frozendict(), - header_params: RequestHeaderParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - cookie_params: RequestCookieParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _parameter_collisions_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - query_params: RequestQueryParams = frozendict.frozendict(), - header_params: RequestHeaderParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - cookie_params: RequestCookieParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _parameter_collisions_oapg( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - query_params: RequestQueryParams = frozendict.frozendict(), - header_params: RequestHeaderParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - cookie_params: RequestCookieParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - parameter collision case - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - self._verify_typed_dict_inputs_oapg(RequestQueryParams, query_params) - self._verify_typed_dict_inputs_oapg(RequestHeaderParams, header_params) - self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) - self._verify_typed_dict_inputs_oapg(RequestCookieParams, cookie_params) - used_path = path.value - - _path_params = {} - for parameter in ( - request_path__3, - request_path_a_b5, - request_path_ab2, - request_path__self3, - request_path_a_b6, - ): - parameter_data = path_params.get(parameter.name, schemas.unset) - if parameter_data is schemas.unset: - continue - serialized_data = parameter.serialize(parameter_data) - _path_params.update(serialized_data) - - for k, v in _path_params.items(): - used_path = used_path.replace('{%s}' % k, v) - - prefix_separator_iterator = None - for parameter in ( - request_query__1, - request_query_a_b, - request_query_ab, - request_query__self, - request_query_a_b2, - ): - parameter_data = query_params.get(parameter.name, schemas.unset) - if parameter_data is schemas.unset: - continue - if prefix_separator_iterator is None: - prefix_separator_iterator = parameter.get_prefix_separator_iterator() - serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) - for serialized_value in serialized_data.values(): - used_path += serialized_value - - _headers = HTTPHeaderDict() - for parameter in ( - request_header__2, - request_header_a_b3, - request_header__self2, - request_header_a_b4, - ): - parameter_data = header_params.get(parameter.name, schemas.unset) - if parameter_data is schemas.unset: - continue - serialized_data = parameter.serialize(parameter_data) - _headers.extend(serialized_data) - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - _fields = None - _body = None - if body is not schemas.unset: - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class ParameterCollisions(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def parameter_collisions( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - query_params: RequestQueryParams = frozendict.frozendict(), - header_params: RequestHeaderParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - cookie_params: RequestCookieParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def parameter_collisions( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - query_params: RequestQueryParams = frozendict.frozendict(), - header_params: RequestHeaderParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - cookie_params: RequestCookieParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def parameter_collisions( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - query_params: RequestQueryParams = frozendict.frozendict(), - header_params: RequestHeaderParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - cookie_params: RequestCookieParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def parameter_collisions( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - query_params: RequestQueryParams = frozendict.frozendict(), - header_params: RequestHeaderParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - cookie_params: RequestCookieParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def parameter_collisions( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - query_params: RequestQueryParams = frozendict.frozendict(), - header_params: RequestHeaderParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - cookie_params: RequestCookieParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._parameter_collisions_oapg( - body=body, - query_params=query_params, - header_params=header_params, - path_params=path_params, - cookie_params=cookie_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - query_params: RequestQueryParams = frozendict.frozendict(), - header_params: RequestHeaderParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - cookie_params: RequestCookieParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - query_params: RequestQueryParams = frozendict.frozendict(), - header_params: RequestHeaderParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - cookie_params: RequestCookieParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - query_params: RequestQueryParams = frozendict.frozendict(), - header_params: RequestHeaderParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - cookie_params: RequestCookieParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - query_params: RequestQueryParams = frozendict.frozendict(), - header_params: RequestHeaderParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - cookie_params: RequestCookieParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - query_params: RequestQueryParams = frozendict.frozendict(), - header_params: RequestHeaderParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - cookie_params: RequestCookieParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._parameter_collisions_oapg( - body=body, - query_params=query_params, - header_params=header_params, - path_params=path_params, - cookie_params=cookie_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_parameter_collisions_1_a_b_ab_self_a_b_/post.pyi b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_parameter_collisions_1_a_b_ab_self_a_b_/post.pyi deleted file mode 100644 index b24853ab38c..00000000000 --- a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_parameter_collisions_1_a_b_ab_self_a_b_/post.pyi +++ /dev/null @@ -1,656 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from petstore_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from petstore_api import schemas # noqa: F401 - -# Query params -Model1Schema = schemas.StrSchema -ABSchema = schemas.StrSchema -AbSchema = schemas.StrSchema -ModelSelfSchema = schemas.StrSchema -ABSchema = schemas.StrSchema -RequestRequiredQueryParams = typing_extensions.TypedDict( - 'RequestRequiredQueryParams', - { - } -) -RequestOptionalQueryParams = typing_extensions.TypedDict( - 'RequestOptionalQueryParams', - { - '1': typing.Union[Model1Schema, str, ], - 'aB': typing.Union[ABSchema, str, ], - 'Ab': typing.Union[AbSchema, str, ], - 'self': typing.Union[ModelSelfSchema, str, ], - 'A-B': typing.Union[ABSchema, str, ], - }, - total=False -) - - -class RequestQueryParams(RequestRequiredQueryParams, RequestOptionalQueryParams): - pass - - -request_query__1 = api_client.QueryParameter( - name="1", - style=api_client.ParameterStyle.FORM, - schema=Model1Schema, - explode=True, -) -request_query_a_b = api_client.QueryParameter( - name="aB", - style=api_client.ParameterStyle.FORM, - schema=ABSchema, - explode=True, -) -request_query_ab = api_client.QueryParameter( - name="Ab", - style=api_client.ParameterStyle.FORM, - schema=AbSchema, - explode=True, -) -request_query__self = api_client.QueryParameter( - name="self", - style=api_client.ParameterStyle.FORM, - schema=ModelSelfSchema, - explode=True, -) -request_query_a_b2 = api_client.QueryParameter( - name="A-B", - style=api_client.ParameterStyle.FORM, - schema=ABSchema, - explode=True, -) -# Header params -Model1Schema = schemas.StrSchema -ABSchema = schemas.StrSchema -ModelSelfSchema = schemas.StrSchema -ABSchema = schemas.StrSchema -RequestRequiredHeaderParams = typing_extensions.TypedDict( - 'RequestRequiredHeaderParams', - { - } -) -RequestOptionalHeaderParams = typing_extensions.TypedDict( - 'RequestOptionalHeaderParams', - { - '1': typing.Union[Model1Schema, str, ], - 'aB': typing.Union[ABSchema, str, ], - 'self': typing.Union[ModelSelfSchema, str, ], - 'A-B': typing.Union[ABSchema, str, ], - }, - total=False -) - - -class RequestHeaderParams(RequestRequiredHeaderParams, RequestOptionalHeaderParams): - pass - - -request_header__2 = api_client.HeaderParameter( - name="1", - style=api_client.ParameterStyle.SIMPLE, - schema=Model1Schema, -) -request_header_a_b3 = api_client.HeaderParameter( - name="aB", - style=api_client.ParameterStyle.SIMPLE, - schema=ABSchema, -) -request_header__self2 = api_client.HeaderParameter( - name="self", - style=api_client.ParameterStyle.SIMPLE, - schema=ModelSelfSchema, -) -request_header_a_b4 = api_client.HeaderParameter( - name="A-B", - style=api_client.ParameterStyle.SIMPLE, - schema=ABSchema, -) -# Path params -Model1Schema = schemas.StrSchema -ABSchema = schemas.StrSchema -AbSchema = schemas.StrSchema -ModelSelfSchema = schemas.StrSchema -ABSchema = schemas.StrSchema -RequestRequiredPathParams = typing_extensions.TypedDict( - 'RequestRequiredPathParams', - { - '1': typing.Union[Model1Schema, str, ], - 'aB': typing.Union[ABSchema, str, ], - 'Ab': typing.Union[AbSchema, str, ], - 'self': typing.Union[ModelSelfSchema, str, ], - 'A-B': typing.Union[ABSchema, str, ], - } -) -RequestOptionalPathParams = typing_extensions.TypedDict( - 'RequestOptionalPathParams', - { - }, - total=False -) - - -class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): - pass - - -request_path__3 = api_client.PathParameter( - name="1", - style=api_client.ParameterStyle.SIMPLE, - schema=Model1Schema, - required=True, -) -request_path_a_b5 = api_client.PathParameter( - name="aB", - style=api_client.ParameterStyle.SIMPLE, - schema=ABSchema, - required=True, -) -request_path_ab2 = api_client.PathParameter( - name="Ab", - style=api_client.ParameterStyle.SIMPLE, - schema=AbSchema, - required=True, -) -request_path__self3 = api_client.PathParameter( - name="self", - style=api_client.ParameterStyle.SIMPLE, - schema=ModelSelfSchema, - required=True, -) -request_path_a_b6 = api_client.PathParameter( - name="A-B", - style=api_client.ParameterStyle.SIMPLE, - schema=ABSchema, - required=True, -) -# Cookie params -Model1Schema = schemas.StrSchema -ABSchema = schemas.StrSchema -AbSchema = schemas.StrSchema -ModelSelfSchema = schemas.StrSchema -ABSchema = schemas.StrSchema -RequestRequiredCookieParams = typing_extensions.TypedDict( - 'RequestRequiredCookieParams', - { - } -) -RequestOptionalCookieParams = typing_extensions.TypedDict( - 'RequestOptionalCookieParams', - { - '1': typing.Union[Model1Schema, str, ], - 'aB': typing.Union[ABSchema, str, ], - 'Ab': typing.Union[AbSchema, str, ], - 'self': typing.Union[ModelSelfSchema, str, ], - 'A-B': typing.Union[ABSchema, str, ], - }, - total=False -) - - -class RequestCookieParams(RequestRequiredCookieParams, RequestOptionalCookieParams): - pass - - -request_cookie__4 = api_client.CookieParameter( - name="1", - style=api_client.ParameterStyle.FORM, - schema=Model1Schema, - explode=True, -) -request_cookie_a_b7 = api_client.CookieParameter( - name="aB", - style=api_client.ParameterStyle.FORM, - schema=ABSchema, - explode=True, -) -request_cookie_ab3 = api_client.CookieParameter( - name="Ab", - style=api_client.ParameterStyle.FORM, - schema=AbSchema, - explode=True, -) -request_cookie__self4 = api_client.CookieParameter( - name="self", - style=api_client.ParameterStyle.FORM, - schema=ModelSelfSchema, - explode=True, -) -request_cookie_a_b8 = api_client.CookieParameter( - name="A-B", - style=api_client.ParameterStyle.FORM, - schema=ABSchema, - explode=True, -) -# body param -SchemaForRequestBodyApplicationJson = schemas.AnyTypeSchema - - -request_body_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, -) -SchemaFor200ResponseBodyApplicationJson = schemas.AnyTypeSchema - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _parameter_collisions_oapg( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - query_params: RequestQueryParams = frozendict.frozendict(), - header_params: RequestHeaderParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - cookie_params: RequestCookieParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _parameter_collisions_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - query_params: RequestQueryParams = frozendict.frozendict(), - header_params: RequestHeaderParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - cookie_params: RequestCookieParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _parameter_collisions_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - query_params: RequestQueryParams = frozendict.frozendict(), - header_params: RequestHeaderParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - cookie_params: RequestCookieParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _parameter_collisions_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - query_params: RequestQueryParams = frozendict.frozendict(), - header_params: RequestHeaderParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - cookie_params: RequestCookieParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _parameter_collisions_oapg( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - query_params: RequestQueryParams = frozendict.frozendict(), - header_params: RequestHeaderParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - cookie_params: RequestCookieParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - parameter collision case - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - self._verify_typed_dict_inputs_oapg(RequestQueryParams, query_params) - self._verify_typed_dict_inputs_oapg(RequestHeaderParams, header_params) - self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) - self._verify_typed_dict_inputs_oapg(RequestCookieParams, cookie_params) - used_path = path.value - - _path_params = {} - for parameter in ( - request_path__3, - request_path_a_b5, - request_path_ab2, - request_path__self3, - request_path_a_b6, - ): - parameter_data = path_params.get(parameter.name, schemas.unset) - if parameter_data is schemas.unset: - continue - serialized_data = parameter.serialize(parameter_data) - _path_params.update(serialized_data) - - for k, v in _path_params.items(): - used_path = used_path.replace('{%s}' % k, v) - - prefix_separator_iterator = None - for parameter in ( - request_query__1, - request_query_a_b, - request_query_ab, - request_query__self, - request_query_a_b2, - ): - parameter_data = query_params.get(parameter.name, schemas.unset) - if parameter_data is schemas.unset: - continue - if prefix_separator_iterator is None: - prefix_separator_iterator = parameter.get_prefix_separator_iterator() - serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) - for serialized_value in serialized_data.values(): - used_path += serialized_value - - _headers = HTTPHeaderDict() - for parameter in ( - request_header__2, - request_header_a_b3, - request_header__self2, - request_header_a_b4, - ): - parameter_data = header_params.get(parameter.name, schemas.unset) - if parameter_data is schemas.unset: - continue - serialized_data = parameter.serialize(parameter_data) - _headers.extend(serialized_data) - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - _fields = None - _body = None - if body is not schemas.unset: - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class ParameterCollisions(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def parameter_collisions( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - query_params: RequestQueryParams = frozendict.frozendict(), - header_params: RequestHeaderParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - cookie_params: RequestCookieParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def parameter_collisions( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - query_params: RequestQueryParams = frozendict.frozendict(), - header_params: RequestHeaderParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - cookie_params: RequestCookieParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def parameter_collisions( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - query_params: RequestQueryParams = frozendict.frozendict(), - header_params: RequestHeaderParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - cookie_params: RequestCookieParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def parameter_collisions( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - query_params: RequestQueryParams = frozendict.frozendict(), - header_params: RequestHeaderParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - cookie_params: RequestCookieParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def parameter_collisions( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - query_params: RequestQueryParams = frozendict.frozendict(), - header_params: RequestHeaderParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - cookie_params: RequestCookieParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._parameter_collisions_oapg( - body=body, - query_params=query_params, - header_params=header_params, - path_params=path_params, - cookie_params=cookie_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - query_params: RequestQueryParams = frozendict.frozendict(), - header_params: RequestHeaderParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - cookie_params: RequestCookieParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - query_params: RequestQueryParams = frozendict.frozendict(), - header_params: RequestHeaderParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - cookie_params: RequestCookieParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - query_params: RequestQueryParams = frozendict.frozendict(), - header_params: RequestHeaderParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - cookie_params: RequestCookieParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - query_params: RequestQueryParams = frozendict.frozendict(), - header_params: RequestHeaderParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - cookie_params: RequestCookieParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - query_params: RequestQueryParams = frozendict.frozendict(), - header_params: RequestHeaderParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - cookie_params: RequestCookieParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._parameter_collisions_oapg( - body=body, - query_params=query_params, - header_params=header_params, - path_params=path_params, - cookie_params=cookie_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_parameter_collisions_1_a_b_ab_self_a_b_/post/__init__.py b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_parameter_collisions_1_a_b_ab_self_a_b_/post/__init__.py new file mode 100644 index 00000000000..1a4b068d367 --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_parameter_collisions_1_a_b_ab_self_a_b_/post/__init__.py @@ -0,0 +1,654 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 + + + +class RequestQueryParameters: + class Schemas: + _1 = schemas.StrSchema + aB = schemas.StrSchema + Ab = schemas.StrSchema + _self = schemas.StrSchema + a_b = schemas.StrSchema + + + RequiredParams = typing_extensions.TypedDict( + 'RequiredParams', + { + } + ) + OptionalParams = typing_extensions.TypedDict( + 'OptionalParams', + { + '1': typing.Union[Schemas._1, str, ], + 'aB': typing.Union[Schemas.aB, str, ], + 'Ab': typing.Union[Schemas.Ab, str, ], + 'self': typing.Union[Schemas._self, str, ], + 'A-B': typing.Union[Schemas.a_b, str, ], + }, + total=False + ) + + + class Params(RequiredParams, OptionalParams): + pass + + + parameters = [ + api_client.QueryParameter( + name="1", + style=api_client.ParameterStyle.FORM, + schema=Schemas._1, + explode=True, + ), + api_client.QueryParameter( + name="aB", + style=api_client.ParameterStyle.FORM, + schema=Schemas.aB, + explode=True, + ), + api_client.QueryParameter( + name="Ab", + style=api_client.ParameterStyle.FORM, + schema=Schemas.Ab, + explode=True, + ), + api_client.QueryParameter( + name="self", + style=api_client.ParameterStyle.FORM, + schema=Schemas._self, + explode=True, + ), + api_client.QueryParameter( + name="A-B", + style=api_client.ParameterStyle.FORM, + schema=Schemas.a_b, + explode=True, + ), + ] + +class RequestHeaderParameters: + class Schemas: + _1 = schemas.StrSchema + aB = schemas.StrSchema + _self = schemas.StrSchema + a_b = schemas.StrSchema + + + RequiredParams = typing_extensions.TypedDict( + 'RequiredParams', + { + } + ) + OptionalParams = typing_extensions.TypedDict( + 'OptionalParams', + { + '1': typing.Union[Schemas._1, str, ], + 'aB': typing.Union[Schemas.aB, str, ], + 'self': typing.Union[Schemas._self, str, ], + 'A-B': typing.Union[Schemas.a_b, str, ], + }, + total=False + ) + + + class Params(RequiredParams, OptionalParams): + pass + + + parameters = [ + api_client.HeaderParameter( + name="1", + style=api_client.ParameterStyle.SIMPLE, + schema=Schemas._1, + ), + api_client.HeaderParameter( + name="aB", + style=api_client.ParameterStyle.SIMPLE, + schema=Schemas.aB, + ), + api_client.HeaderParameter( + name="self", + style=api_client.ParameterStyle.SIMPLE, + schema=Schemas._self, + ), + api_client.HeaderParameter( + name="A-B", + style=api_client.ParameterStyle.SIMPLE, + schema=Schemas.a_b, + ), + ] + +class RequestPathParameters: + class Schemas: + _1 = schemas.StrSchema + aB = schemas.StrSchema + Ab = schemas.StrSchema + _self = schemas.StrSchema + a_b = schemas.StrSchema + + + RequiredParams = typing_extensions.TypedDict( + 'RequiredParams', + { + '1': typing.Union[Schemas._1, str, ], + 'aB': typing.Union[Schemas.aB, str, ], + 'Ab': typing.Union[Schemas.Ab, str, ], + 'self': typing.Union[Schemas._self, str, ], + 'A-B': typing.Union[Schemas.a_b, str, ], + } + ) + OptionalParams = typing_extensions.TypedDict( + 'OptionalParams', + { + }, + total=False + ) + + + class Params(RequiredParams, OptionalParams): + pass + + + parameters = [ + api_client.PathParameter( + name="1", + style=api_client.ParameterStyle.SIMPLE, + schema=Schemas._1, + required=True, + ), + api_client.PathParameter( + name="aB", + style=api_client.ParameterStyle.SIMPLE, + schema=Schemas.aB, + required=True, + ), + api_client.PathParameter( + name="Ab", + style=api_client.ParameterStyle.SIMPLE, + schema=Schemas.Ab, + required=True, + ), + api_client.PathParameter( + name="self", + style=api_client.ParameterStyle.SIMPLE, + schema=Schemas._self, + required=True, + ), + api_client.PathParameter( + name="A-B", + style=api_client.ParameterStyle.SIMPLE, + schema=Schemas.a_b, + required=True, + ), + ] + +class RequestCookieParameters: + class Schemas: + _1 = schemas.StrSchema + aB = schemas.StrSchema + Ab = schemas.StrSchema + _self = schemas.StrSchema + a_b = schemas.StrSchema + + + RequiredParams = typing_extensions.TypedDict( + 'RequiredParams', + { + } + ) + OptionalParams = typing_extensions.TypedDict( + 'OptionalParams', + { + '1': typing.Union[Schemas._1, str, ], + 'aB': typing.Union[Schemas.aB, str, ], + 'Ab': typing.Union[Schemas.Ab, str, ], + 'self': typing.Union[Schemas._self, str, ], + 'A-B': typing.Union[Schemas.a_b, str, ], + }, + total=False + ) + + + class Params(RequiredParams, OptionalParams): + pass + + + parameters = [ + api_client.CookieParameter( + name="1", + style=api_client.ParameterStyle.FORM, + schema=Schemas._1, + explode=True, + ), + api_client.CookieParameter( + name="aB", + style=api_client.ParameterStyle.FORM, + schema=Schemas.aB, + explode=True, + ), + api_client.CookieParameter( + name="Ab", + style=api_client.ParameterStyle.FORM, + schema=Schemas.Ab, + explode=True, + ), + api_client.CookieParameter( + name="self", + style=api_client.ParameterStyle.FORM, + schema=Schemas._self, + explode=True, + ), + api_client.CookieParameter( + name="A-B", + style=api_client.ParameterStyle.FORM, + schema=Schemas.a_b, + explode=True, + ), + ] + +class RequestBody: + class Schemas: + application_json = schemas.AnyTypeSchema + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + ) + +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _parameter_collisions_oapg( + self, + content_type: typing_extensions.Literal["application/json"] = ..., + body: typing.Union[RequestBody.Schemas.application_json, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + header_params: RequestHeaderParameters.Params = frozendict.frozendict(), + path_params: RequestPathParameters.Params = frozendict.frozendict(), + cookie_params: RequestCookieParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _parameter_collisions_oapg( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + header_params: RequestHeaderParameters.Params = frozendict.frozendict(), + path_params: RequestPathParameters.Params = frozendict.frozendict(), + cookie_params: RequestCookieParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _parameter_collisions_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + header_params: RequestHeaderParameters.Params = frozendict.frozendict(), + path_params: RequestPathParameters.Params = frozendict.frozendict(), + cookie_params: RequestCookieParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _parameter_collisions_oapg( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + header_params: RequestHeaderParameters.Params = frozendict.frozendict(), + path_params: RequestPathParameters.Params = frozendict.frozendict(), + cookie_params: RequestCookieParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _parameter_collisions_oapg( + self, + content_type: str = 'application/json', + body: typing.Union[RequestBody.Schemas.application_json, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + header_params: RequestHeaderParameters.Params = frozendict.frozendict(), + path_params: RequestPathParameters.Params = frozendict.frozendict(), + cookie_params: RequestCookieParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + parameter collision case + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + self._verify_typed_dict_inputs_oapg(RequestQueryParameters.Params, query_params) + self._verify_typed_dict_inputs_oapg(RequestHeaderParameters.Params, header_params) + self._verify_typed_dict_inputs_oapg(RequestPathParameters.Params, path_params) + self._verify_typed_dict_inputs_oapg(RequestCookieParameters.Params, cookie_params) + used_path = path.value + + _path_params = {} + for parameter in RequestPathParameters.parameters: + parameter_data = path_params.get(parameter.name, schemas.unset) + if parameter_data is schemas.unset: + continue + serialized_data = parameter.serialize(parameter_data) + _path_params.update(serialized_data) + + for k, v in _path_params.items(): + used_path = used_path.replace('{%s}' % k, v) + + prefix_separator_iterator = None + for parameter in RequestQueryParameters.parameters: + parameter_data = query_params.get(parameter.name, schemas.unset) + if parameter_data is schemas.unset: + continue + if prefix_separator_iterator is None: + prefix_separator_iterator = parameter.get_prefix_separator_iterator() + serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) + for serialized_value in serialized_data.values(): + used_path += serialized_value + + _headers = HTTPHeaderDict() + for parameter in RequestHeaderParameters.parameters: + parameter_data = header_params.get(parameter.name, schemas.unset) + if parameter_data is schemas.unset: + continue + serialized_data = parameter.serialize(parameter_data) + _headers.extend(serialized_data) + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + _fields = None + _body = None + if body is not schemas.unset: + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class ParameterCollisions(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def parameter_collisions( + self, + content_type: typing_extensions.Literal["application/json"] = ..., + body: typing.Union[RequestBody.Schemas.application_json, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + header_params: RequestHeaderParameters.Params = frozendict.frozendict(), + path_params: RequestPathParameters.Params = frozendict.frozendict(), + cookie_params: RequestCookieParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def parameter_collisions( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + header_params: RequestHeaderParameters.Params = frozendict.frozendict(), + path_params: RequestPathParameters.Params = frozendict.frozendict(), + cookie_params: RequestCookieParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def parameter_collisions( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + header_params: RequestHeaderParameters.Params = frozendict.frozendict(), + path_params: RequestPathParameters.Params = frozendict.frozendict(), + cookie_params: RequestCookieParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def parameter_collisions( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + header_params: RequestHeaderParameters.Params = frozendict.frozendict(), + path_params: RequestPathParameters.Params = frozendict.frozendict(), + cookie_params: RequestCookieParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def parameter_collisions( + self, + content_type: str = 'application/json', + body: typing.Union[RequestBody.Schemas.application_json, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + header_params: RequestHeaderParameters.Params = frozendict.frozendict(), + path_params: RequestPathParameters.Params = frozendict.frozendict(), + cookie_params: RequestCookieParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._parameter_collisions_oapg( + body=body, + query_params=query_params, + header_params=header_params, + path_params=path_params, + cookie_params=cookie_params, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + content_type: typing_extensions.Literal["application/json"] = ..., + body: typing.Union[RequestBody.Schemas.application_json, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + header_params: RequestHeaderParameters.Params = frozendict.frozendict(), + path_params: RequestPathParameters.Params = frozendict.frozendict(), + cookie_params: RequestCookieParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + header_params: RequestHeaderParameters.Params = frozendict.frozendict(), + path_params: RequestPathParameters.Params = frozendict.frozendict(), + cookie_params: RequestCookieParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + header_params: RequestHeaderParameters.Params = frozendict.frozendict(), + path_params: RequestPathParameters.Params = frozendict.frozendict(), + cookie_params: RequestCookieParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + header_params: RequestHeaderParameters.Params = frozendict.frozendict(), + path_params: RequestPathParameters.Params = frozendict.frozendict(), + cookie_params: RequestCookieParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + content_type: str = 'application/json', + body: typing.Union[RequestBody.Schemas.application_json, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + header_params: RequestHeaderParameters.Params = frozendict.frozendict(), + path_params: RequestPathParameters.Params = frozendict.frozendict(), + cookie_params: RequestCookieParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._parameter_collisions_oapg( + body=body, + query_params=query_params, + header_params=header_params, + path_params=path_params, + cookie_params=cookie_params, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_parameter_collisions_1_a_b_ab_self_a_b_/post/__init__.pyi b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_parameter_collisions_1_a_b_ab_self_a_b_/post/__init__.pyi new file mode 100644 index 00000000000..dd9f036348f --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_parameter_collisions_1_a_b_ab_self_a_b_/post/__init__.pyi @@ -0,0 +1,649 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from . import response_for_200 + + + +class RequestQueryParameters: + class Schemas: + _1 = schemas.StrSchema + aB = schemas.StrSchema + Ab = schemas.StrSchema + _self = schemas.StrSchema + a_b = schemas.StrSchema + + + RequiredParams = typing_extensions.TypedDict( + 'RequiredParams', + { + } + ) + OptionalParams = typing_extensions.TypedDict( + 'OptionalParams', + { + '1': typing.Union[Schemas._1, str, ], + 'aB': typing.Union[Schemas.aB, str, ], + 'Ab': typing.Union[Schemas.Ab, str, ], + 'self': typing.Union[Schemas._self, str, ], + 'A-B': typing.Union[Schemas.a_b, str, ], + }, + total=False + ) + + + class Params(RequiredParams, OptionalParams): + pass + + + parameters = [ + api_client.QueryParameter( + name="1", + style=api_client.ParameterStyle.FORM, + schema=Schemas._1, + explode=True, + ), + api_client.QueryParameter( + name="aB", + style=api_client.ParameterStyle.FORM, + schema=Schemas.aB, + explode=True, + ), + api_client.QueryParameter( + name="Ab", + style=api_client.ParameterStyle.FORM, + schema=Schemas.Ab, + explode=True, + ), + api_client.QueryParameter( + name="self", + style=api_client.ParameterStyle.FORM, + schema=Schemas._self, + explode=True, + ), + api_client.QueryParameter( + name="A-B", + style=api_client.ParameterStyle.FORM, + schema=Schemas.a_b, + explode=True, + ), + ] + +class RequestHeaderParameters: + class Schemas: + _1 = schemas.StrSchema + aB = schemas.StrSchema + _self = schemas.StrSchema + a_b = schemas.StrSchema + + + RequiredParams = typing_extensions.TypedDict( + 'RequiredParams', + { + } + ) + OptionalParams = typing_extensions.TypedDict( + 'OptionalParams', + { + '1': typing.Union[Schemas._1, str, ], + 'aB': typing.Union[Schemas.aB, str, ], + 'self': typing.Union[Schemas._self, str, ], + 'A-B': typing.Union[Schemas.a_b, str, ], + }, + total=False + ) + + + class Params(RequiredParams, OptionalParams): + pass + + + parameters = [ + api_client.HeaderParameter( + name="1", + style=api_client.ParameterStyle.SIMPLE, + schema=Schemas._1, + ), + api_client.HeaderParameter( + name="aB", + style=api_client.ParameterStyle.SIMPLE, + schema=Schemas.aB, + ), + api_client.HeaderParameter( + name="self", + style=api_client.ParameterStyle.SIMPLE, + schema=Schemas._self, + ), + api_client.HeaderParameter( + name="A-B", + style=api_client.ParameterStyle.SIMPLE, + schema=Schemas.a_b, + ), + ] + +class RequestPathParameters: + class Schemas: + _1 = schemas.StrSchema + aB = schemas.StrSchema + Ab = schemas.StrSchema + _self = schemas.StrSchema + a_b = schemas.StrSchema + + + RequiredParams = typing_extensions.TypedDict( + 'RequiredParams', + { + '1': typing.Union[Schemas._1, str, ], + 'aB': typing.Union[Schemas.aB, str, ], + 'Ab': typing.Union[Schemas.Ab, str, ], + 'self': typing.Union[Schemas._self, str, ], + 'A-B': typing.Union[Schemas.a_b, str, ], + } + ) + OptionalParams = typing_extensions.TypedDict( + 'OptionalParams', + { + }, + total=False + ) + + + class Params(RequiredParams, OptionalParams): + pass + + + parameters = [ + api_client.PathParameter( + name="1", + style=api_client.ParameterStyle.SIMPLE, + schema=Schemas._1, + required=True, + ), + api_client.PathParameter( + name="aB", + style=api_client.ParameterStyle.SIMPLE, + schema=Schemas.aB, + required=True, + ), + api_client.PathParameter( + name="Ab", + style=api_client.ParameterStyle.SIMPLE, + schema=Schemas.Ab, + required=True, + ), + api_client.PathParameter( + name="self", + style=api_client.ParameterStyle.SIMPLE, + schema=Schemas._self, + required=True, + ), + api_client.PathParameter( + name="A-B", + style=api_client.ParameterStyle.SIMPLE, + schema=Schemas.a_b, + required=True, + ), + ] + +class RequestCookieParameters: + class Schemas: + _1 = schemas.StrSchema + aB = schemas.StrSchema + Ab = schemas.StrSchema + _self = schemas.StrSchema + a_b = schemas.StrSchema + + + RequiredParams = typing_extensions.TypedDict( + 'RequiredParams', + { + } + ) + OptionalParams = typing_extensions.TypedDict( + 'OptionalParams', + { + '1': typing.Union[Schemas._1, str, ], + 'aB': typing.Union[Schemas.aB, str, ], + 'Ab': typing.Union[Schemas.Ab, str, ], + 'self': typing.Union[Schemas._self, str, ], + 'A-B': typing.Union[Schemas.a_b, str, ], + }, + total=False + ) + + + class Params(RequiredParams, OptionalParams): + pass + + + parameters = [ + api_client.CookieParameter( + name="1", + style=api_client.ParameterStyle.FORM, + schema=Schemas._1, + explode=True, + ), + api_client.CookieParameter( + name="aB", + style=api_client.ParameterStyle.FORM, + schema=Schemas.aB, + explode=True, + ), + api_client.CookieParameter( + name="Ab", + style=api_client.ParameterStyle.FORM, + schema=Schemas.Ab, + explode=True, + ), + api_client.CookieParameter( + name="self", + style=api_client.ParameterStyle.FORM, + schema=Schemas._self, + explode=True, + ), + api_client.CookieParameter( + name="A-B", + style=api_client.ParameterStyle.FORM, + schema=Schemas.a_b, + explode=True, + ), + ] + +class RequestBody: + class Schemas: + application_json = schemas.AnyTypeSchema + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + ) +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _parameter_collisions_oapg( + self, + content_type: typing_extensions.Literal["application/json"] = ..., + body: typing.Union[RequestBody.Schemas.application_json, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + header_params: RequestHeaderParameters.Params = frozendict.frozendict(), + path_params: RequestPathParameters.Params = frozendict.frozendict(), + cookie_params: RequestCookieParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _parameter_collisions_oapg( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + header_params: RequestHeaderParameters.Params = frozendict.frozendict(), + path_params: RequestPathParameters.Params = frozendict.frozendict(), + cookie_params: RequestCookieParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _parameter_collisions_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + header_params: RequestHeaderParameters.Params = frozendict.frozendict(), + path_params: RequestPathParameters.Params = frozendict.frozendict(), + cookie_params: RequestCookieParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _parameter_collisions_oapg( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + header_params: RequestHeaderParameters.Params = frozendict.frozendict(), + path_params: RequestPathParameters.Params = frozendict.frozendict(), + cookie_params: RequestCookieParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _parameter_collisions_oapg( + self, + content_type: str = 'application/json', + body: typing.Union[RequestBody.Schemas.application_json, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + header_params: RequestHeaderParameters.Params = frozendict.frozendict(), + path_params: RequestPathParameters.Params = frozendict.frozendict(), + cookie_params: RequestCookieParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + parameter collision case + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + self._verify_typed_dict_inputs_oapg(RequestQueryParameters.Params, query_params) + self._verify_typed_dict_inputs_oapg(RequestHeaderParameters.Params, header_params) + self._verify_typed_dict_inputs_oapg(RequestPathParameters.Params, path_params) + self._verify_typed_dict_inputs_oapg(RequestCookieParameters.Params, cookie_params) + used_path = path.value + + _path_params = {} + for parameter in RequestPathParameters.parameters: + parameter_data = path_params.get(parameter.name, schemas.unset) + if parameter_data is schemas.unset: + continue + serialized_data = parameter.serialize(parameter_data) + _path_params.update(serialized_data) + + for k, v in _path_params.items(): + used_path = used_path.replace('{%s}' % k, v) + + prefix_separator_iterator = None + for parameter in RequestQueryParameters.parameters: + parameter_data = query_params.get(parameter.name, schemas.unset) + if parameter_data is schemas.unset: + continue + if prefix_separator_iterator is None: + prefix_separator_iterator = parameter.get_prefix_separator_iterator() + serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) + for serialized_value in serialized_data.values(): + used_path += serialized_value + + _headers = HTTPHeaderDict() + for parameter in RequestHeaderParameters.parameters: + parameter_data = header_params.get(parameter.name, schemas.unset) + if parameter_data is schemas.unset: + continue + serialized_data = parameter.serialize(parameter_data) + _headers.extend(serialized_data) + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + _fields = None + _body = None + if body is not schemas.unset: + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class ParameterCollisions(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def parameter_collisions( + self, + content_type: typing_extensions.Literal["application/json"] = ..., + body: typing.Union[RequestBody.Schemas.application_json, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + header_params: RequestHeaderParameters.Params = frozendict.frozendict(), + path_params: RequestPathParameters.Params = frozendict.frozendict(), + cookie_params: RequestCookieParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def parameter_collisions( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + header_params: RequestHeaderParameters.Params = frozendict.frozendict(), + path_params: RequestPathParameters.Params = frozendict.frozendict(), + cookie_params: RequestCookieParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def parameter_collisions( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + header_params: RequestHeaderParameters.Params = frozendict.frozendict(), + path_params: RequestPathParameters.Params = frozendict.frozendict(), + cookie_params: RequestCookieParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def parameter_collisions( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + header_params: RequestHeaderParameters.Params = frozendict.frozendict(), + path_params: RequestPathParameters.Params = frozendict.frozendict(), + cookie_params: RequestCookieParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def parameter_collisions( + self, + content_type: str = 'application/json', + body: typing.Union[RequestBody.Schemas.application_json, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + header_params: RequestHeaderParameters.Params = frozendict.frozendict(), + path_params: RequestPathParameters.Params = frozendict.frozendict(), + cookie_params: RequestCookieParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._parameter_collisions_oapg( + body=body, + query_params=query_params, + header_params=header_params, + path_params=path_params, + cookie_params=cookie_params, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + content_type: typing_extensions.Literal["application/json"] = ..., + body: typing.Union[RequestBody.Schemas.application_json, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + header_params: RequestHeaderParameters.Params = frozendict.frozendict(), + path_params: RequestPathParameters.Params = frozendict.frozendict(), + cookie_params: RequestCookieParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + header_params: RequestHeaderParameters.Params = frozendict.frozendict(), + path_params: RequestPathParameters.Params = frozendict.frozendict(), + cookie_params: RequestCookieParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + header_params: RequestHeaderParameters.Params = frozendict.frozendict(), + path_params: RequestPathParameters.Params = frozendict.frozendict(), + cookie_params: RequestCookieParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + header_params: RequestHeaderParameters.Params = frozendict.frozendict(), + path_params: RequestPathParameters.Params = frozendict.frozendict(), + cookie_params: RequestCookieParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + content_type: str = 'application/json', + body: typing.Union[RequestBody.Schemas.application_json, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + header_params: RequestHeaderParameters.Params = frozendict.frozendict(), + path_params: RequestPathParameters.Params = frozendict.frozendict(), + cookie_params: RequestCookieParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._parameter_collisions_oapg( + body=body, + query_params=query_params, + header_params=header_params, + path_params=path_params, + cookie_params=cookie_params, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_parameter_collisions_1_a_b_ab_self_a_b_/post/response_for_200.py b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_parameter_collisions_1_a_b_ab_self_a_b_/post/response_for_200.py new file mode 100644 index 00000000000..90561be6384 --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_parameter_collisions_1_a_b_ab_self_a_b_/post/response_for_200.py @@ -0,0 +1,41 @@ +import dataclasses +import urllib3 + +from petstore_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + + +class BodySchemas: + # body schemas + application_json = schemas.AnyTypeSchema + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_pet_id_upload_image_with_required_file/post.py b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_pet_id_upload_image_with_required_file/post.py deleted file mode 100644 index d5fb0a61b07..00000000000 --- a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_pet_id_upload_image_with_required_file/post.py +++ /dev/null @@ -1,451 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from petstore_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from petstore_api import schemas # noqa: F401 - -from petstore_api.model.api_response import ApiResponse - -from . import path - -# Path params -PetIdSchema = schemas.Int64Schema -RequestRequiredPathParams = typing_extensions.TypedDict( - 'RequestRequiredPathParams', - { - 'petId': typing.Union[PetIdSchema, decimal.Decimal, int, ], - } -) -RequestOptionalPathParams = typing_extensions.TypedDict( - 'RequestOptionalPathParams', - { - }, - total=False -) - - -class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): - pass - - -request_path_pet_id = api_client.PathParameter( - name="petId", - style=api_client.ParameterStyle.SIMPLE, - schema=PetIdSchema, - required=True, -) -# body param - - -class SchemaForRequestBodyMultipartFormData( - schemas.DictSchema -): - - - class MetaOapg: - required = { - "requiredFile", - } - - class properties: - additionalMetadata = schemas.StrSchema - requiredFile = schemas.BinarySchema - __annotations__ = { - "additionalMetadata": additionalMetadata, - "requiredFile": requiredFile, - } - - requiredFile: MetaOapg.properties.requiredFile - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["additionalMetadata"]) -> MetaOapg.properties.additionalMetadata: ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["requiredFile"]) -> MetaOapg.properties.requiredFile: ... - - @typing.overload - def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... - - def __getitem__(self, name: typing.Union[typing_extensions.Literal["additionalMetadata", "requiredFile", ], str]): - # dict_instance[name] accessor - return super().__getitem__(name) - - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["additionalMetadata"]) -> typing.Union[MetaOapg.properties.additionalMetadata, schemas.Unset]: ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["requiredFile"]) -> MetaOapg.properties.requiredFile: ... - - @typing.overload - def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... - - def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["additionalMetadata", "requiredFile", ], str]): - return super().get_item_oapg(name) - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, ], - requiredFile: typing.Union[MetaOapg.properties.requiredFile, bytes, io.FileIO, io.BufferedReader, ], - additionalMetadata: typing.Union[MetaOapg.properties.additionalMetadata, str, schemas.Unset] = schemas.unset, - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'SchemaForRequestBodyMultipartFormData': - return super().__new__( - cls, - *args, - requiredFile=requiredFile, - additionalMetadata=additionalMetadata, - _configuration=_configuration, - **kwargs, - ) - - -request_body_body = api_client.RequestBody( - content={ - 'multipart/form-data': api_client.MediaType( - schema=SchemaForRequestBodyMultipartFormData), - }, -) -_auth = [ - 'petstore_auth', -] -SchemaFor200ResponseBodyApplicationJson = ApiResponse - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_status_code_to_response = { - '200': _response_for_200, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _upload_file_with_required_file_oapg( - self, - content_type: typing_extensions.Literal["multipart/form-data"] = ..., - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _upload_file_with_required_file_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _upload_file_with_required_file_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _upload_file_with_required_file_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _upload_file_with_required_file_oapg( - self, - content_type: str = 'multipart/form-data', - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - uploads an image (required) - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) - used_path = path.value - - _path_params = {} - for parameter in ( - request_path_pet_id, - ): - parameter_data = path_params.get(parameter.name, schemas.unset) - if parameter_data is schemas.unset: - continue - serialized_data = parameter.serialize(parameter_data) - _path_params.update(serialized_data) - - for k, v in _path_params.items(): - used_path = used_path.replace('{%s}' % k, v) - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - _fields = None - _body = None - if body is not schemas.unset: - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class UploadFileWithRequiredFile(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def upload_file_with_required_file( - self, - content_type: typing_extensions.Literal["multipart/form-data"] = ..., - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def upload_file_with_required_file( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def upload_file_with_required_file( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def upload_file_with_required_file( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def upload_file_with_required_file( - self, - content_type: str = 'multipart/form-data', - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._upload_file_with_required_file_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - content_type: typing_extensions.Literal["multipart/form-data"] = ..., - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - content_type: str = 'multipart/form-data', - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._upload_file_with_required_file_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_pet_id_upload_image_with_required_file/post.pyi b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_pet_id_upload_image_with_required_file/post.pyi deleted file mode 100644 index 94f430e8bb7..00000000000 --- a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_pet_id_upload_image_with_required_file/post.pyi +++ /dev/null @@ -1,443 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from petstore_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from petstore_api import schemas # noqa: F401 - -from petstore_api.model.api_response import ApiResponse - -# Path params -PetIdSchema = schemas.Int64Schema -RequestRequiredPathParams = typing_extensions.TypedDict( - 'RequestRequiredPathParams', - { - 'petId': typing.Union[PetIdSchema, decimal.Decimal, int, ], - } -) -RequestOptionalPathParams = typing_extensions.TypedDict( - 'RequestOptionalPathParams', - { - }, - total=False -) - - -class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): - pass - - -request_path_pet_id = api_client.PathParameter( - name="petId", - style=api_client.ParameterStyle.SIMPLE, - schema=PetIdSchema, - required=True, -) -# body param - - -class SchemaForRequestBodyMultipartFormData( - schemas.DictSchema -): - - - class MetaOapg: - required = { - "requiredFile", - } - - class properties: - additionalMetadata = schemas.StrSchema - requiredFile = schemas.BinarySchema - __annotations__ = { - "additionalMetadata": additionalMetadata, - "requiredFile": requiredFile, - } - - requiredFile: MetaOapg.properties.requiredFile - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["additionalMetadata"]) -> MetaOapg.properties.additionalMetadata: ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["requiredFile"]) -> MetaOapg.properties.requiredFile: ... - - @typing.overload - def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... - - def __getitem__(self, name: typing.Union[typing_extensions.Literal["additionalMetadata", "requiredFile", ], str]): - # dict_instance[name] accessor - return super().__getitem__(name) - - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["additionalMetadata"]) -> typing.Union[MetaOapg.properties.additionalMetadata, schemas.Unset]: ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["requiredFile"]) -> MetaOapg.properties.requiredFile: ... - - @typing.overload - def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... - - def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["additionalMetadata", "requiredFile", ], str]): - return super().get_item_oapg(name) - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, ], - requiredFile: typing.Union[MetaOapg.properties.requiredFile, bytes, io.FileIO, io.BufferedReader, ], - additionalMetadata: typing.Union[MetaOapg.properties.additionalMetadata, str, schemas.Unset] = schemas.unset, - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'SchemaForRequestBodyMultipartFormData': - return super().__new__( - cls, - *args, - requiredFile=requiredFile, - additionalMetadata=additionalMetadata, - _configuration=_configuration, - **kwargs, - ) - - -request_body_body = api_client.RequestBody( - content={ - 'multipart/form-data': api_client.MediaType( - schema=SchemaForRequestBodyMultipartFormData), - }, -) -SchemaFor200ResponseBodyApplicationJson = ApiResponse - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _upload_file_with_required_file_oapg( - self, - content_type: typing_extensions.Literal["multipart/form-data"] = ..., - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _upload_file_with_required_file_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _upload_file_with_required_file_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _upload_file_with_required_file_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _upload_file_with_required_file_oapg( - self, - content_type: str = 'multipart/form-data', - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - uploads an image (required) - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) - used_path = path.value - - _path_params = {} - for parameter in ( - request_path_pet_id, - ): - parameter_data = path_params.get(parameter.name, schemas.unset) - if parameter_data is schemas.unset: - continue - serialized_data = parameter.serialize(parameter_data) - _path_params.update(serialized_data) - - for k, v in _path_params.items(): - used_path = used_path.replace('{%s}' % k, v) - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - _fields = None - _body = None - if body is not schemas.unset: - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class UploadFileWithRequiredFile(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def upload_file_with_required_file( - self, - content_type: typing_extensions.Literal["multipart/form-data"] = ..., - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def upload_file_with_required_file( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def upload_file_with_required_file( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def upload_file_with_required_file( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def upload_file_with_required_file( - self, - content_type: str = 'multipart/form-data', - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._upload_file_with_required_file_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - content_type: typing_extensions.Literal["multipart/form-data"] = ..., - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - content_type: str = 'multipart/form-data', - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._upload_file_with_required_file_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_pet_id_upload_image_with_required_file/post/__init__.py b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_pet_id_upload_image_with_required_file/post/__init__.py new file mode 100644 index 00000000000..b0731015f8d --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_pet_id_upload_image_with_required_file/post/__init__.py @@ -0,0 +1,440 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 + + + +class RequestPathParameters: + class Schemas: + petId = schemas.Int64Schema + + + RequiredParams = typing_extensions.TypedDict( + 'RequiredParams', + { + 'petId': typing.Union[Schemas.petId, decimal.Decimal, int, ], + } + ) + OptionalParams = typing_extensions.TypedDict( + 'OptionalParams', + { + }, + total=False + ) + + + class Params(RequiredParams, OptionalParams): + pass + + + parameters = [ + api_client.PathParameter( + name="petId", + style=api_client.ParameterStyle.SIMPLE, + schema=Schemas.petId, + required=True, + ), + ] + +class RequestBody: + class Schemas: + + + class multipart_form_data( + schemas.DictSchema + ): + + + class MetaOapg: + required = { + "requiredFile", + } + + class properties: + additionalMetadata = schemas.StrSchema + requiredFile = schemas.BinarySchema + __annotations__ = { + "additionalMetadata": additionalMetadata, + "requiredFile": requiredFile, + } + + requiredFile: MetaOapg.properties.requiredFile + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["additionalMetadata"]) -> MetaOapg.properties.additionalMetadata: ... + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["requiredFile"]) -> MetaOapg.properties.requiredFile: ... + + @typing.overload + def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... + + def __getitem__(self, name: typing.Union[typing_extensions.Literal["additionalMetadata", "requiredFile", ], str]): + # dict_instance[name] accessor + return super().__getitem__(name) + + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["additionalMetadata"]) -> typing.Union[MetaOapg.properties.additionalMetadata, schemas.Unset]: ... + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["requiredFile"]) -> MetaOapg.properties.requiredFile: ... + + @typing.overload + def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... + + def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["additionalMetadata", "requiredFile", ], str]): + return super().get_item_oapg(name) + + + def __new__( + cls, + *args: typing.Union[dict, frozendict.frozendict, ], + requiredFile: typing.Union[MetaOapg.properties.requiredFile, bytes, io.FileIO, io.BufferedReader, ], + additionalMetadata: typing.Union[MetaOapg.properties.additionalMetadata, str, schemas.Unset] = schemas.unset, + _configuration: typing.Optional[schemas.Configuration] = None, + **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], + ) -> 'multipart_form_data': + return super().__new__( + cls, + *args, + requiredFile=requiredFile, + additionalMetadata=additionalMetadata, + _configuration=_configuration, + **kwargs, + ) + + parameter = api_client.RequestBody( + content={ + 'multipart/form-data': api_client.MediaType( + schema=Schemas.multipart_form_data + ), + }, + ) + +_auth = [ + 'petstore_auth', +] + +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _upload_file_with_required_file_oapg( + self, + content_type: typing_extensions.Literal["multipart/form-data"] = ..., + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _upload_file_with_required_file_oapg( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _upload_file_with_required_file_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _upload_file_with_required_file_oapg( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _upload_file_with_required_file_oapg( + self, + content_type: str = 'multipart/form-data', + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + uploads an image (required) + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + self._verify_typed_dict_inputs_oapg(RequestPathParameters.Params, path_params) + used_path = path.value + + _path_params = {} + for parameter in RequestPathParameters.parameters: + parameter_data = path_params.get(parameter.name, schemas.unset) + if parameter_data is schemas.unset: + continue + serialized_data = parameter.serialize(parameter_data) + _path_params.update(serialized_data) + + for k, v in _path_params.items(): + used_path = used_path.replace('{%s}' % k, v) + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + _fields = None + _body = None + if body is not schemas.unset: + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + auth_settings=_auth, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class UploadFileWithRequiredFile(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def upload_file_with_required_file( + self, + content_type: typing_extensions.Literal["multipart/form-data"] = ..., + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def upload_file_with_required_file( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def upload_file_with_required_file( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def upload_file_with_required_file( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def upload_file_with_required_file( + self, + content_type: str = 'multipart/form-data', + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._upload_file_with_required_file_oapg( + body=body, + path_params=path_params, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + content_type: typing_extensions.Literal["multipart/form-data"] = ..., + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + content_type: str = 'multipart/form-data', + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._upload_file_with_required_file_oapg( + body=body, + path_params=path_params, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_pet_id_upload_image_with_required_file/post/__init__.pyi b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_pet_id_upload_image_with_required_file/post/__init__.pyi new file mode 100644 index 00000000000..663e77bf699 --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_pet_id_upload_image_with_required_file/post/__init__.pyi @@ -0,0 +1,431 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from . import response_for_200 + + + +class RequestPathParameters: + class Schemas: + petId = schemas.Int64Schema + + + RequiredParams = typing_extensions.TypedDict( + 'RequiredParams', + { + 'petId': typing.Union[Schemas.petId, decimal.Decimal, int, ], + } + ) + OptionalParams = typing_extensions.TypedDict( + 'OptionalParams', + { + }, + total=False + ) + + + class Params(RequiredParams, OptionalParams): + pass + + + parameters = [ + api_client.PathParameter( + name="petId", + style=api_client.ParameterStyle.SIMPLE, + schema=Schemas.petId, + required=True, + ), + ] + +class RequestBody: + class Schemas: + + + class multipart_form_data( + schemas.DictSchema + ): + + + class MetaOapg: + required = { + "requiredFile", + } + + class properties: + additionalMetadata = schemas.StrSchema + requiredFile = schemas.BinarySchema + __annotations__ = { + "additionalMetadata": additionalMetadata, + "requiredFile": requiredFile, + } + + requiredFile: MetaOapg.properties.requiredFile + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["additionalMetadata"]) -> MetaOapg.properties.additionalMetadata: ... + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["requiredFile"]) -> MetaOapg.properties.requiredFile: ... + + @typing.overload + def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... + + def __getitem__(self, name: typing.Union[typing_extensions.Literal["additionalMetadata", "requiredFile", ], str]): + # dict_instance[name] accessor + return super().__getitem__(name) + + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["additionalMetadata"]) -> typing.Union[MetaOapg.properties.additionalMetadata, schemas.Unset]: ... + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["requiredFile"]) -> MetaOapg.properties.requiredFile: ... + + @typing.overload + def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... + + def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["additionalMetadata", "requiredFile", ], str]): + return super().get_item_oapg(name) + + + def __new__( + cls, + *args: typing.Union[dict, frozendict.frozendict, ], + requiredFile: typing.Union[MetaOapg.properties.requiredFile, bytes, io.FileIO, io.BufferedReader, ], + additionalMetadata: typing.Union[MetaOapg.properties.additionalMetadata, str, schemas.Unset] = schemas.unset, + _configuration: typing.Optional[schemas.Configuration] = None, + **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], + ) -> 'multipart_form_data': + return super().__new__( + cls, + *args, + requiredFile=requiredFile, + additionalMetadata=additionalMetadata, + _configuration=_configuration, + **kwargs, + ) + + parameter = api_client.RequestBody( + content={ + 'multipart/form-data': api_client.MediaType( + schema=Schemas.multipart_form_data + ), + }, + ) +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _upload_file_with_required_file_oapg( + self, + content_type: typing_extensions.Literal["multipart/form-data"] = ..., + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _upload_file_with_required_file_oapg( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _upload_file_with_required_file_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _upload_file_with_required_file_oapg( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _upload_file_with_required_file_oapg( + self, + content_type: str = 'multipart/form-data', + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + uploads an image (required) + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + self._verify_typed_dict_inputs_oapg(RequestPathParameters.Params, path_params) + used_path = path.value + + _path_params = {} + for parameter in RequestPathParameters.parameters: + parameter_data = path_params.get(parameter.name, schemas.unset) + if parameter_data is schemas.unset: + continue + serialized_data = parameter.serialize(parameter_data) + _path_params.update(serialized_data) + + for k, v in _path_params.items(): + used_path = used_path.replace('{%s}' % k, v) + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + _fields = None + _body = None + if body is not schemas.unset: + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + auth_settings=_auth, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class UploadFileWithRequiredFile(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def upload_file_with_required_file( + self, + content_type: typing_extensions.Literal["multipart/form-data"] = ..., + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def upload_file_with_required_file( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def upload_file_with_required_file( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def upload_file_with_required_file( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def upload_file_with_required_file( + self, + content_type: str = 'multipart/form-data', + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._upload_file_with_required_file_oapg( + body=body, + path_params=path_params, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + content_type: typing_extensions.Literal["multipart/form-data"] = ..., + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + content_type: str = 'multipart/form-data', + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._upload_file_with_required_file_oapg( + body=body, + path_params=path_params, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_pet_id_upload_image_with_required_file/post/response_for_200.py b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_pet_id_upload_image_with_required_file/post/response_for_200.py new file mode 100644 index 00000000000..55c94e2ea12 --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_pet_id_upload_image_with_required_file/post/response_for_200.py @@ -0,0 +1,43 @@ +import dataclasses +import urllib3 + +from petstore_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from petstore_api.model.api_response import ApiResponse + + +class BodySchemas: + # body schemas + application_json = ApiResponse + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_query_param_with_json_content_type/get.py b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_query_param_with_json_content_type/get.py deleted file mode 100644 index c829e40dd2d..00000000000 --- a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_query_param_with_json_content_type/get.py +++ /dev/null @@ -1,288 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from petstore_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from petstore_api import schemas # noqa: F401 - -from . import path - -# Query params -SchemaForRequestParameterSomeParamApplicationJson = schemas.AnyTypeSchema -RequestRequiredQueryParams = typing_extensions.TypedDict( - 'RequestRequiredQueryParams', - { - 'someParam': typing.Union[SchemaForRequestParameterSomeParamApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - } -) -RequestOptionalQueryParams = typing_extensions.TypedDict( - 'RequestOptionalQueryParams', - { - }, - total=False -) - - -class RequestQueryParams(RequestRequiredQueryParams, RequestOptionalQueryParams): - pass - - -request_query_some_param = api_client.QueryParameter( - name="someParam", - content={ - "application/json": SchemaForRequestParameterSomeParamApplicationJson, - }, - required=True, -) -SchemaFor200ResponseBodyApplicationJson = schemas.AnyTypeSchema - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_status_code_to_response = { - '200': _response_for_200, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _query_param_with_json_content_type_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _query_param_with_json_content_type_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _query_param_with_json_content_type_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _query_param_with_json_content_type_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - query param with json content-type - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - self._verify_typed_dict_inputs_oapg(RequestQueryParams, query_params) - used_path = path.value - - prefix_separator_iterator = None - for parameter in ( - request_query_some_param, - ): - parameter_data = query_params.get(parameter.name, schemas.unset) - if parameter_data is schemas.unset: - continue - if prefix_separator_iterator is None: - prefix_separator_iterator = parameter.get_prefix_separator_iterator() - serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) - for serialized_value in serialized_data.values(): - used_path += serialized_value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='get'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class QueryParamWithJsonContentType(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def query_param_with_json_content_type( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def query_param_with_json_content_type( - self, - skip_deserialization: typing_extensions.Literal[True], - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def query_param_with_json_content_type( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def query_param_with_json_content_type( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._query_param_with_json_content_type_oapg( - query_params=query_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForget(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def get( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def get( - self, - skip_deserialization: typing_extensions.Literal[True], - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._query_param_with_json_content_type_oapg( - query_params=query_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_query_param_with_json_content_type/get.pyi b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_query_param_with_json_content_type/get.pyi deleted file mode 100644 index ccf449dcfdd..00000000000 --- a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_query_param_with_json_content_type/get.pyi +++ /dev/null @@ -1,283 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from petstore_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from petstore_api import schemas # noqa: F401 - -# Query params -SchemaForRequestParameterSomeParamApplicationJson = schemas.AnyTypeSchema -RequestRequiredQueryParams = typing_extensions.TypedDict( - 'RequestRequiredQueryParams', - { - 'someParam': typing.Union[SchemaForRequestParameterSomeParamApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - } -) -RequestOptionalQueryParams = typing_extensions.TypedDict( - 'RequestOptionalQueryParams', - { - }, - total=False -) - - -class RequestQueryParams(RequestRequiredQueryParams, RequestOptionalQueryParams): - pass - - -request_query_some_param = api_client.QueryParameter( - name="someParam", - content={ - "application/json": SchemaForRequestParameterSomeParamApplicationJson, - }, - required=True, -) -SchemaFor200ResponseBodyApplicationJson = schemas.AnyTypeSchema - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _query_param_with_json_content_type_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _query_param_with_json_content_type_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _query_param_with_json_content_type_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _query_param_with_json_content_type_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - query param with json content-type - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - self._verify_typed_dict_inputs_oapg(RequestQueryParams, query_params) - used_path = path.value - - prefix_separator_iterator = None - for parameter in ( - request_query_some_param, - ): - parameter_data = query_params.get(parameter.name, schemas.unset) - if parameter_data is schemas.unset: - continue - if prefix_separator_iterator is None: - prefix_separator_iterator = parameter.get_prefix_separator_iterator() - serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) - for serialized_value in serialized_data.values(): - used_path += serialized_value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='get'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class QueryParamWithJsonContentType(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def query_param_with_json_content_type( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def query_param_with_json_content_type( - self, - skip_deserialization: typing_extensions.Literal[True], - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def query_param_with_json_content_type( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def query_param_with_json_content_type( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._query_param_with_json_content_type_oapg( - query_params=query_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForget(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def get( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def get( - self, - skip_deserialization: typing_extensions.Literal[True], - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._query_param_with_json_content_type_oapg( - query_params=query_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_query_param_with_json_content_type/get/__init__.py b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_query_param_with_json_content_type/get/__init__.py new file mode 100644 index 00000000000..14acb34990a --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_query_param_with_json_content_type/get/__init__.py @@ -0,0 +1,275 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 + + + +class RequestQueryParameters: + class Schemas: + someParam = schemas.AnyTypeSchema + + + RequiredParams = typing_extensions.TypedDict( + 'RequiredParams', + { + 'someParam': typing.Union[Schemas.someParam, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], + } + ) + OptionalParams = typing_extensions.TypedDict( + 'OptionalParams', + { + }, + total=False + ) + + + class Params(RequiredParams, OptionalParams): + pass + + + parameters = [ + api_client.QueryParameter( + name="someParam", + content={ + "application/json": Schemas.someParam, + }, + required=True, + ), + ] +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _query_param_with_json_content_type_oapg( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _query_param_with_json_content_type_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _query_param_with_json_content_type_oapg( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _query_param_with_json_content_type_oapg( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + query param with json content-type + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + self._verify_typed_dict_inputs_oapg(RequestQueryParameters.Params, query_params) + used_path = path.value + + prefix_separator_iterator = None + for parameter in RequestQueryParameters.parameters: + parameter_data = query_params.get(parameter.name, schemas.unset) + if parameter_data is schemas.unset: + continue + if prefix_separator_iterator is None: + prefix_separator_iterator = parameter.get_prefix_separator_iterator() + serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) + for serialized_value in serialized_data.values(): + used_path += serialized_value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='get'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class QueryParamWithJsonContentType(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def query_param_with_json_content_type( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def query_param_with_json_content_type( + self, + skip_deserialization: typing_extensions.Literal[True], + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def query_param_with_json_content_type( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def query_param_with_json_content_type( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._query_param_with_json_content_type_oapg( + query_params=query_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForget(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def get( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def get( + self, + skip_deserialization: typing_extensions.Literal[True], + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def get( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def get( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._query_param_with_json_content_type_oapg( + query_params=query_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_query_param_with_json_content_type/get/__init__.pyi b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_query_param_with_json_content_type/get/__init__.pyi new file mode 100644 index 00000000000..0d85255ec49 --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_query_param_with_json_content_type/get/__init__.pyi @@ -0,0 +1,270 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from . import response_for_200 + + + +class RequestQueryParameters: + class Schemas: + someParam = schemas.AnyTypeSchema + + + RequiredParams = typing_extensions.TypedDict( + 'RequiredParams', + { + 'someParam': typing.Union[Schemas.someParam, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], + } + ) + OptionalParams = typing_extensions.TypedDict( + 'OptionalParams', + { + }, + total=False + ) + + + class Params(RequiredParams, OptionalParams): + pass + + + parameters = [ + api_client.QueryParameter( + name="someParam", + content={ + "application/json": Schemas.someParam, + }, + required=True, + ), + ]_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _query_param_with_json_content_type_oapg( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _query_param_with_json_content_type_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _query_param_with_json_content_type_oapg( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _query_param_with_json_content_type_oapg( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + query param with json content-type + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + self._verify_typed_dict_inputs_oapg(RequestQueryParameters.Params, query_params) + used_path = path.value + + prefix_separator_iterator = None + for parameter in RequestQueryParameters.parameters: + parameter_data = query_params.get(parameter.name, schemas.unset) + if parameter_data is schemas.unset: + continue + if prefix_separator_iterator is None: + prefix_separator_iterator = parameter.get_prefix_separator_iterator() + serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) + for serialized_value in serialized_data.values(): + used_path += serialized_value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='get'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class QueryParamWithJsonContentType(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def query_param_with_json_content_type( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def query_param_with_json_content_type( + self, + skip_deserialization: typing_extensions.Literal[True], + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def query_param_with_json_content_type( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def query_param_with_json_content_type( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._query_param_with_json_content_type_oapg( + query_params=query_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForget(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def get( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def get( + self, + skip_deserialization: typing_extensions.Literal[True], + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def get( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def get( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._query_param_with_json_content_type_oapg( + query_params=query_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_query_param_with_json_content_type/get/response_for_200.py b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_query_param_with_json_content_type/get/response_for_200.py new file mode 100644 index 00000000000..90561be6384 --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_query_param_with_json_content_type/get/response_for_200.py @@ -0,0 +1,41 @@ +import dataclasses +import urllib3 + +from petstore_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + + +class BodySchemas: + # body schemas + application_json = schemas.AnyTypeSchema + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_ref_obj_in_query/get.py b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_ref_obj_in_query/get.py deleted file mode 100644 index 6a5556eb380..00000000000 --- a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_ref_obj_in_query/get.py +++ /dev/null @@ -1,258 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 - -from petstore_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from petstore_api import schemas # noqa: F401 - -from petstore_api.model.foo import Foo - -from . import path - -# Query params -MapBeanSchema = Foo -RequestRequiredQueryParams = typing_extensions.TypedDict( - 'RequestRequiredQueryParams', - { - } -) -RequestOptionalQueryParams = typing_extensions.TypedDict( - 'RequestOptionalQueryParams', - { - 'mapBean': typing.Union[MapBeanSchema, ], - }, - total=False -) - - -class RequestQueryParams(RequestRequiredQueryParams, RequestOptionalQueryParams): - pass - - -request_query_map_bean = api_client.QueryParameter( - name="mapBean", - style=api_client.ParameterStyle.DEEP_OBJECT, - schema=MapBeanSchema, - explode=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) -_status_code_to_response = { - '200': _response_for_200, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _ref_object_in_query_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _ref_object_in_query_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _ref_object_in_query_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _ref_object_in_query_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - user list - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - self._verify_typed_dict_inputs_oapg(RequestQueryParams, query_params) - used_path = path.value - - prefix_separator_iterator = None - for parameter in ( - request_query_map_bean, - ): - parameter_data = query_params.get(parameter.name, schemas.unset) - if parameter_data is schemas.unset: - continue - if prefix_separator_iterator is None: - prefix_separator_iterator = parameter.get_prefix_separator_iterator() - serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) - for serialized_value in serialized_data.values(): - used_path += serialized_value - # TODO add cookie handling - - response = self.api_client.call_api( - resource_path=used_path, - method='get'.upper(), - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class RefObjectInQuery(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def ref_object_in_query( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def ref_object_in_query( - self, - skip_deserialization: typing_extensions.Literal[True], - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def ref_object_in_query( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def ref_object_in_query( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._ref_object_in_query_oapg( - query_params=query_params, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForget(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def get( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def get( - self, - skip_deserialization: typing_extensions.Literal[True], - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._ref_object_in_query_oapg( - query_params=query_params, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_ref_obj_in_query/get.pyi b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_ref_obj_in_query/get.pyi deleted file mode 100644 index 70a37a3ac11..00000000000 --- a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_ref_obj_in_query/get.pyi +++ /dev/null @@ -1,253 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 - -from petstore_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from petstore_api import schemas # noqa: F401 - -from petstore_api.model.foo import Foo - -# Query params -MapBeanSchema = Foo -RequestRequiredQueryParams = typing_extensions.TypedDict( - 'RequestRequiredQueryParams', - { - } -) -RequestOptionalQueryParams = typing_extensions.TypedDict( - 'RequestOptionalQueryParams', - { - 'mapBean': typing.Union[MapBeanSchema, ], - }, - total=False -) - - -class RequestQueryParams(RequestRequiredQueryParams, RequestOptionalQueryParams): - pass - - -request_query_map_bean = api_client.QueryParameter( - name="mapBean", - style=api_client.ParameterStyle.DEEP_OBJECT, - schema=MapBeanSchema, - explode=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _ref_object_in_query_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _ref_object_in_query_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _ref_object_in_query_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _ref_object_in_query_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - user list - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - self._verify_typed_dict_inputs_oapg(RequestQueryParams, query_params) - used_path = path.value - - prefix_separator_iterator = None - for parameter in ( - request_query_map_bean, - ): - parameter_data = query_params.get(parameter.name, schemas.unset) - if parameter_data is schemas.unset: - continue - if prefix_separator_iterator is None: - prefix_separator_iterator = parameter.get_prefix_separator_iterator() - serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) - for serialized_value in serialized_data.values(): - used_path += serialized_value - # TODO add cookie handling - - response = self.api_client.call_api( - resource_path=used_path, - method='get'.upper(), - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class RefObjectInQuery(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def ref_object_in_query( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def ref_object_in_query( - self, - skip_deserialization: typing_extensions.Literal[True], - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def ref_object_in_query( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def ref_object_in_query( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._ref_object_in_query_oapg( - query_params=query_params, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForget(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def get( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def get( - self, - skip_deserialization: typing_extensions.Literal[True], - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._ref_object_in_query_oapg( - query_params=query_params, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_ref_obj_in_query/get/__init__.py b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_ref_obj_in_query/get/__init__.py new file mode 100644 index 00000000000..46e416ef744 --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_ref_obj_in_query/get/__init__.py @@ -0,0 +1,252 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from petstore_api.model.foo import Foo + +from .. import path +from . import response_for_200 + + + +class RequestQueryParameters: + class Schemas: + mapBean = Foo + + + RequiredParams = typing_extensions.TypedDict( + 'RequiredParams', + { + } + ) + OptionalParams = typing_extensions.TypedDict( + 'OptionalParams', + { + 'mapBean': typing.Union[Schemas.mapBean, ], + }, + total=False + ) + + + class Params(RequiredParams, OptionalParams): + pass + + + parameters = [ + api_client.QueryParameter( + name="mapBean", + style=api_client.ParameterStyle.DEEP_OBJECT, + schema=Schemas.mapBean, + explode=True, + ), + ] +_status_code_to_response = { + '200': response_for_200.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _ref_object_in_query_oapg( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _ref_object_in_query_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _ref_object_in_query_oapg( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _ref_object_in_query_oapg( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + user list + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + self._verify_typed_dict_inputs_oapg(RequestQueryParameters.Params, query_params) + used_path = path.value + + prefix_separator_iterator = None + for parameter in RequestQueryParameters.parameters: + parameter_data = query_params.get(parameter.name, schemas.unset) + if parameter_data is schemas.unset: + continue + if prefix_separator_iterator is None: + prefix_separator_iterator = parameter.get_prefix_separator_iterator() + serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) + for serialized_value in serialized_data.values(): + used_path += serialized_value + # TODO add cookie handling + + response = self.api_client.call_api( + resource_path=used_path, + method='get'.upper(), + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class RefObjectInQuery(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def ref_object_in_query( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def ref_object_in_query( + self, + skip_deserialization: typing_extensions.Literal[True], + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def ref_object_in_query( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def ref_object_in_query( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._ref_object_in_query_oapg( + query_params=query_params, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForget(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def get( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def get( + self, + skip_deserialization: typing_extensions.Literal[True], + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def get( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def get( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._ref_object_in_query_oapg( + query_params=query_params, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_ref_obj_in_query/get/__init__.pyi b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_ref_obj_in_query/get/__init__.pyi new file mode 100644 index 00000000000..8ab64a9ead2 --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_ref_obj_in_query/get/__init__.pyi @@ -0,0 +1,247 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from petstore_api.model.foo import Foo + +from . import response_for_200 + + + +class RequestQueryParameters: + class Schemas: + mapBean = Foo + + + RequiredParams = typing_extensions.TypedDict( + 'RequiredParams', + { + } + ) + OptionalParams = typing_extensions.TypedDict( + 'OptionalParams', + { + 'mapBean': typing.Union[Schemas.mapBean, ], + }, + total=False + ) + + + class Params(RequiredParams, OptionalParams): + pass + + + parameters = [ + api_client.QueryParameter( + name="mapBean", + style=api_client.ParameterStyle.DEEP_OBJECT, + schema=Schemas.mapBean, + explode=True, + ), + ] + +class BaseApi(api_client.Api): + @typing.overload + def _ref_object_in_query_oapg( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _ref_object_in_query_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _ref_object_in_query_oapg( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _ref_object_in_query_oapg( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + user list + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + self._verify_typed_dict_inputs_oapg(RequestQueryParameters.Params, query_params) + used_path = path.value + + prefix_separator_iterator = None + for parameter in RequestQueryParameters.parameters: + parameter_data = query_params.get(parameter.name, schemas.unset) + if parameter_data is schemas.unset: + continue + if prefix_separator_iterator is None: + prefix_separator_iterator = parameter.get_prefix_separator_iterator() + serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) + for serialized_value in serialized_data.values(): + used_path += serialized_value + # TODO add cookie handling + + response = self.api_client.call_api( + resource_path=used_path, + method='get'.upper(), + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class RefObjectInQuery(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def ref_object_in_query( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def ref_object_in_query( + self, + skip_deserialization: typing_extensions.Literal[True], + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def ref_object_in_query( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def ref_object_in_query( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._ref_object_in_query_oapg( + query_params=query_params, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForget(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def get( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def get( + self, + skip_deserialization: typing_extensions.Literal[True], + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def get( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def get( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._ref_object_in_query_oapg( + query_params=query_params, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_ref_obj_in_query/get/response_for_200.py b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_ref_obj_in_query/get/response_for_200.py new file mode 100644 index 00000000000..7ec95a8627a --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_ref_obj_in_query/get/response_for_200.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from petstore_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_array_of_enums/post.py b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_array_of_enums/post.py deleted file mode 100644 index f8ec75ce3ef..00000000000 --- a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_array_of_enums/post.py +++ /dev/null @@ -1,326 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from petstore_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from petstore_api import schemas # noqa: F401 - -from petstore_api.model.array_of_enums import ArrayOfEnums - -from . import path - -# body param -SchemaForRequestBodyApplicationJson = ArrayOfEnums - - -request_body_array_of_enums = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, -) -SchemaFor200ResponseBodyApplicationJson = ArrayOfEnums - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_status_code_to_response = { - '200': _response_for_200, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _array_of_enums_oapg( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _array_of_enums_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _array_of_enums_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _array_of_enums_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _array_of_enums_oapg( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - Array of Enums - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - _fields = None - _body = None - if body is not schemas.unset: - serialized_data = request_body_array_of_enums.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class ArrayOfEnums(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def array_of_enums( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def array_of_enums( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def array_of_enums( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def array_of_enums( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def array_of_enums( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._array_of_enums_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._array_of_enums_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_array_of_enums/post.pyi b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_array_of_enums/post.pyi deleted file mode 100644 index ac0fb2920f3..00000000000 --- a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_array_of_enums/post.pyi +++ /dev/null @@ -1,321 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from petstore_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from petstore_api import schemas # noqa: F401 - -from petstore_api.model.array_of_enums import ArrayOfEnums - -# body param -SchemaForRequestBodyApplicationJson = ArrayOfEnums - - -request_body_array_of_enums = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, -) -SchemaFor200ResponseBodyApplicationJson = ArrayOfEnums - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _array_of_enums_oapg( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _array_of_enums_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _array_of_enums_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _array_of_enums_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _array_of_enums_oapg( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - Array of Enums - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - _fields = None - _body = None - if body is not schemas.unset: - serialized_data = request_body_array_of_enums.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class ArrayOfEnums(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def array_of_enums( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def array_of_enums( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def array_of_enums( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def array_of_enums( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def array_of_enums( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._array_of_enums_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._array_of_enums_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_array_of_enums/post/__init__.py b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_array_of_enums/post/__init__.py new file mode 100644 index 00000000000..665a3e2a97c --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_array_of_enums/post/__init__.py @@ -0,0 +1,312 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from petstore_api.model.array_of_enums import ArrayOfEnums + +from .. import path +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = ArrayOfEnums + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + ) + +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _array_of_enums_oapg( + self, + content_type: typing_extensions.Literal["application/json"] = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _array_of_enums_oapg( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _array_of_enums_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _array_of_enums_oapg( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _array_of_enums_oapg( + self, + content_type: str = 'application/json', + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + Array of Enums + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + _fields = None + _body = None + if body is not schemas.unset: + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class ArrayOfEnums(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def array_of_enums( + self, + content_type: typing_extensions.Literal["application/json"] = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def array_of_enums( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def array_of_enums( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def array_of_enums( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def array_of_enums( + self, + content_type: str = 'application/json', + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._array_of_enums_oapg( + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + content_type: typing_extensions.Literal["application/json"] = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + content_type: str = 'application/json', + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._array_of_enums_oapg( + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_array_of_enums/post/__init__.pyi b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_array_of_enums/post/__init__.pyi new file mode 100644 index 00000000000..5150a504a48 --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_array_of_enums/post/__init__.pyi @@ -0,0 +1,307 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from petstore_api.model.array_of_enums import ArrayOfEnums + +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = ArrayOfEnums + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + ) +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _array_of_enums_oapg( + self, + content_type: typing_extensions.Literal["application/json"] = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _array_of_enums_oapg( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _array_of_enums_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _array_of_enums_oapg( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _array_of_enums_oapg( + self, + content_type: str = 'application/json', + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + Array of Enums + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + _fields = None + _body = None + if body is not schemas.unset: + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class ArrayOfEnums(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def array_of_enums( + self, + content_type: typing_extensions.Literal["application/json"] = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def array_of_enums( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def array_of_enums( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def array_of_enums( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def array_of_enums( + self, + content_type: str = 'application/json', + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._array_of_enums_oapg( + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + content_type: typing_extensions.Literal["application/json"] = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + content_type: str = 'application/json', + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._array_of_enums_oapg( + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_array_of_enums/post/response_for_200.py b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_array_of_enums/post/response_for_200.py new file mode 100644 index 00000000000..8bdb51cf3e8 --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_array_of_enums/post/response_for_200.py @@ -0,0 +1,43 @@ +import dataclasses +import urllib3 + +from petstore_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from petstore_api.model.array_of_enums import ArrayOfEnums + + +class BodySchemas: + # body schemas + application_json = ArrayOfEnums + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_arraymodel/post.py b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_arraymodel/post.py deleted file mode 100644 index cebbb40e5fc..00000000000 --- a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_arraymodel/post.py +++ /dev/null @@ -1,325 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from petstore_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from petstore_api import schemas # noqa: F401 - -from petstore_api.model.animal_farm import AnimalFarm - -from . import path - -# body param -SchemaForRequestBodyApplicationJson = AnimalFarm - - -request_body_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, -) -SchemaFor200ResponseBodyApplicationJson = AnimalFarm - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_status_code_to_response = { - '200': _response_for_200, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _array_model_oapg( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _array_model_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _array_model_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _array_model_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _array_model_oapg( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - _fields = None - _body = None - if body is not schemas.unset: - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class ArrayModel(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def array_model( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def array_model( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def array_model( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def array_model( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def array_model( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._array_model_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._array_model_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_arraymodel/post.pyi b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_arraymodel/post.pyi deleted file mode 100644 index ed802fd8c6f..00000000000 --- a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_arraymodel/post.pyi +++ /dev/null @@ -1,320 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from petstore_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from petstore_api import schemas # noqa: F401 - -from petstore_api.model.animal_farm import AnimalFarm - -# body param -SchemaForRequestBodyApplicationJson = AnimalFarm - - -request_body_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, -) -SchemaFor200ResponseBodyApplicationJson = AnimalFarm - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _array_model_oapg( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _array_model_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _array_model_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _array_model_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _array_model_oapg( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - _fields = None - _body = None - if body is not schemas.unset: - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class ArrayModel(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def array_model( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def array_model( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def array_model( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def array_model( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def array_model( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._array_model_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._array_model_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_arraymodel/post/__init__.py b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_arraymodel/post/__init__.py new file mode 100644 index 00000000000..ed9e2d4e32c --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_arraymodel/post/__init__.py @@ -0,0 +1,311 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from petstore_api.model.animal_farm import AnimalFarm + +from .. import path +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = AnimalFarm + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + ) + +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _array_model_oapg( + self, + content_type: typing_extensions.Literal["application/json"] = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _array_model_oapg( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _array_model_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _array_model_oapg( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _array_model_oapg( + self, + content_type: str = 'application/json', + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + _fields = None + _body = None + if body is not schemas.unset: + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class ArrayModel(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def array_model( + self, + content_type: typing_extensions.Literal["application/json"] = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def array_model( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def array_model( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def array_model( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def array_model( + self, + content_type: str = 'application/json', + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._array_model_oapg( + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + content_type: typing_extensions.Literal["application/json"] = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + content_type: str = 'application/json', + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._array_model_oapg( + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_arraymodel/post/__init__.pyi b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_arraymodel/post/__init__.pyi new file mode 100644 index 00000000000..33c48ad9941 --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_arraymodel/post/__init__.pyi @@ -0,0 +1,306 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from petstore_api.model.animal_farm import AnimalFarm + +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = AnimalFarm + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + ) +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _array_model_oapg( + self, + content_type: typing_extensions.Literal["application/json"] = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _array_model_oapg( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _array_model_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _array_model_oapg( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _array_model_oapg( + self, + content_type: str = 'application/json', + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + _fields = None + _body = None + if body is not schemas.unset: + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class ArrayModel(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def array_model( + self, + content_type: typing_extensions.Literal["application/json"] = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def array_model( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def array_model( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def array_model( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def array_model( + self, + content_type: str = 'application/json', + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._array_model_oapg( + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + content_type: typing_extensions.Literal["application/json"] = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + content_type: str = 'application/json', + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._array_model_oapg( + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_arraymodel/post/response_for_200.py b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_arraymodel/post/response_for_200.py new file mode 100644 index 00000000000..bfca2008375 --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_arraymodel/post/response_for_200.py @@ -0,0 +1,43 @@ +import dataclasses +import urllib3 + +from petstore_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from petstore_api.model.animal_farm import AnimalFarm + + +class BodySchemas: + # body schemas + application_json = AnimalFarm + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_boolean/post.py b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_boolean/post.py deleted file mode 100644 index 6eee57e2c63..00000000000 --- a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_boolean/post.py +++ /dev/null @@ -1,323 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from petstore_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from petstore_api import schemas # noqa: F401 - -from . import path - -# body param -SchemaForRequestBodyApplicationJson = schemas.BoolSchema - - -request_body_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, -) -SchemaFor200ResponseBodyApplicationJson = schemas.BoolSchema - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_status_code_to_response = { - '200': _response_for_200, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _boolean_oapg( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, bool, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _boolean_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, bool, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _boolean_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, bool, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _boolean_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, bool, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _boolean_oapg( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, bool, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - _fields = None - _body = None - if body is not schemas.unset: - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class Boolean(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def boolean( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, bool, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def boolean( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, bool, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def boolean( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, bool, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def boolean( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, bool, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def boolean( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, bool, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._boolean_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, bool, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, bool, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, bool, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, bool, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, bool, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._boolean_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_boolean/post.pyi b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_boolean/post.pyi deleted file mode 100644 index 7a975a27bc9..00000000000 --- a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_boolean/post.pyi +++ /dev/null @@ -1,318 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from petstore_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from petstore_api import schemas # noqa: F401 - -# body param -SchemaForRequestBodyApplicationJson = schemas.BoolSchema - - -request_body_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, -) -SchemaFor200ResponseBodyApplicationJson = schemas.BoolSchema - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _boolean_oapg( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, bool, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _boolean_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, bool, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _boolean_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, bool, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _boolean_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, bool, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _boolean_oapg( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, bool, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - _fields = None - _body = None - if body is not schemas.unset: - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class Boolean(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def boolean( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, bool, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def boolean( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, bool, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def boolean( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, bool, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def boolean( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, bool, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def boolean( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, bool, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._boolean_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, bool, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, bool, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, bool, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, bool, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, bool, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._boolean_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_boolean/post/__init__.py b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_boolean/post/__init__.py new file mode 100644 index 00000000000..401be086bad --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_boolean/post/__init__.py @@ -0,0 +1,311 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from petstore_api.model.boolean import Boolean + +from .. import path +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = Boolean + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + ) + +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _boolean_oapg( + self, + content_type: typing_extensions.Literal["application/json"] = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _boolean_oapg( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _boolean_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _boolean_oapg( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _boolean_oapg( + self, + content_type: str = 'application/json', + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + _fields = None + _body = None + if body is not schemas.unset: + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class Boolean(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def boolean( + self, + content_type: typing_extensions.Literal["application/json"] = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def boolean( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def boolean( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def boolean( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def boolean( + self, + content_type: str = 'application/json', + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._boolean_oapg( + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + content_type: typing_extensions.Literal["application/json"] = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + content_type: str = 'application/json', + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._boolean_oapg( + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_boolean/post/__init__.pyi b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_boolean/post/__init__.pyi new file mode 100644 index 00000000000..4640be400ba --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_boolean/post/__init__.pyi @@ -0,0 +1,306 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from petstore_api.model.boolean import Boolean + +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = Boolean + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + ) +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _boolean_oapg( + self, + content_type: typing_extensions.Literal["application/json"] = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _boolean_oapg( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _boolean_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _boolean_oapg( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _boolean_oapg( + self, + content_type: str = 'application/json', + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + _fields = None + _body = None + if body is not schemas.unset: + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class Boolean(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def boolean( + self, + content_type: typing_extensions.Literal["application/json"] = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def boolean( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def boolean( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def boolean( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def boolean( + self, + content_type: str = 'application/json', + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._boolean_oapg( + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + content_type: typing_extensions.Literal["application/json"] = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + content_type: str = 'application/json', + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._boolean_oapg( + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_boolean/post/response_for_200.py b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_boolean/post/response_for_200.py new file mode 100644 index 00000000000..ec533ef13b8 --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_boolean/post/response_for_200.py @@ -0,0 +1,43 @@ +import dataclasses +import urllib3 + +from petstore_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from petstore_api.model.boolean import Boolean + + +class BodySchemas: + # body schemas + application_json = Boolean + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_composed_one_of_number_with_validations/post.py b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_composed_one_of_number_with_validations/post.py deleted file mode 100644 index 84acaf17020..00000000000 --- a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_composed_one_of_number_with_validations/post.py +++ /dev/null @@ -1,325 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from petstore_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from petstore_api import schemas # noqa: F401 - -from petstore_api.model.composed_one_of_different_types import ComposedOneOfDifferentTypes - -from . import path - -# body param -SchemaForRequestBodyApplicationJson = ComposedOneOfDifferentTypes - - -request_body_composed_one_of_different_types = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, -) -SchemaFor200ResponseBodyApplicationJson = ComposedOneOfDifferentTypes - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_status_code_to_response = { - '200': _response_for_200, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _composed_one_of_different_types_oapg( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _composed_one_of_different_types_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _composed_one_of_different_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _composed_one_of_different_types_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _composed_one_of_different_types_oapg( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - _fields = None - _body = None - if body is not schemas.unset: - serialized_data = request_body_composed_one_of_different_types.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class ComposedOneOfDifferentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def composed_one_of_different_types( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def composed_one_of_different_types( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def composed_one_of_different_types( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def composed_one_of_different_types( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def composed_one_of_different_types( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._composed_one_of_different_types_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._composed_one_of_different_types_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_composed_one_of_number_with_validations/post.pyi b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_composed_one_of_number_with_validations/post.pyi deleted file mode 100644 index 30d5f91dba2..00000000000 --- a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_composed_one_of_number_with_validations/post.pyi +++ /dev/null @@ -1,320 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from petstore_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from petstore_api import schemas # noqa: F401 - -from petstore_api.model.composed_one_of_different_types import ComposedOneOfDifferentTypes - -# body param -SchemaForRequestBodyApplicationJson = ComposedOneOfDifferentTypes - - -request_body_composed_one_of_different_types = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, -) -SchemaFor200ResponseBodyApplicationJson = ComposedOneOfDifferentTypes - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _composed_one_of_different_types_oapg( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _composed_one_of_different_types_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _composed_one_of_different_types_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _composed_one_of_different_types_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _composed_one_of_different_types_oapg( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - _fields = None - _body = None - if body is not schemas.unset: - serialized_data = request_body_composed_one_of_different_types.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class ComposedOneOfDifferentTypes(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def composed_one_of_different_types( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def composed_one_of_different_types( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def composed_one_of_different_types( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def composed_one_of_different_types( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def composed_one_of_different_types( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._composed_one_of_different_types_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._composed_one_of_different_types_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_composed_one_of_number_with_validations/post/__init__.py b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_composed_one_of_number_with_validations/post/__init__.py new file mode 100644 index 00000000000..17a062431ea --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_composed_one_of_number_with_validations/post/__init__.py @@ -0,0 +1,311 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from petstore_api.model.composed_one_of_different_types import ComposedOneOfDifferentTypes + +from .. import path +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = ComposedOneOfDifferentTypes + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + ) + +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _composed_one_of_different_types_oapg( + self, + content_type: typing_extensions.Literal["application/json"] = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _composed_one_of_different_types_oapg( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _composed_one_of_different_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _composed_one_of_different_types_oapg( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _composed_one_of_different_types_oapg( + self, + content_type: str = 'application/json', + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + _fields = None + _body = None + if body is not schemas.unset: + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class ComposedOneOfDifferentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def composed_one_of_different_types( + self, + content_type: typing_extensions.Literal["application/json"] = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def composed_one_of_different_types( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def composed_one_of_different_types( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def composed_one_of_different_types( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def composed_one_of_different_types( + self, + content_type: str = 'application/json', + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._composed_one_of_different_types_oapg( + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + content_type: typing_extensions.Literal["application/json"] = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + content_type: str = 'application/json', + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._composed_one_of_different_types_oapg( + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_composed_one_of_number_with_validations/post/__init__.pyi b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_composed_one_of_number_with_validations/post/__init__.pyi new file mode 100644 index 00000000000..389e3f57519 --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_composed_one_of_number_with_validations/post/__init__.pyi @@ -0,0 +1,306 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from petstore_api.model.composed_one_of_different_types import ComposedOneOfDifferentTypes + +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = ComposedOneOfDifferentTypes + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + ) +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _composed_one_of_different_types_oapg( + self, + content_type: typing_extensions.Literal["application/json"] = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _composed_one_of_different_types_oapg( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _composed_one_of_different_types_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _composed_one_of_different_types_oapg( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _composed_one_of_different_types_oapg( + self, + content_type: str = 'application/json', + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + _fields = None + _body = None + if body is not schemas.unset: + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class ComposedOneOfDifferentTypes(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def composed_one_of_different_types( + self, + content_type: typing_extensions.Literal["application/json"] = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def composed_one_of_different_types( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def composed_one_of_different_types( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def composed_one_of_different_types( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def composed_one_of_different_types( + self, + content_type: str = 'application/json', + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._composed_one_of_different_types_oapg( + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + content_type: typing_extensions.Literal["application/json"] = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + content_type: str = 'application/json', + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._composed_one_of_different_types_oapg( + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_composed_one_of_number_with_validations/post/response_for_200.py b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_composed_one_of_number_with_validations/post/response_for_200.py new file mode 100644 index 00000000000..fc2cae69019 --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_composed_one_of_number_with_validations/post/response_for_200.py @@ -0,0 +1,43 @@ +import dataclasses +import urllib3 + +from petstore_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from petstore_api.model.composed_one_of_different_types import ComposedOneOfDifferentTypes + + +class BodySchemas: + # body schemas + application_json = ComposedOneOfDifferentTypes + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_enum/post.py b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_enum/post.py deleted file mode 100644 index 4b953d05000..00000000000 --- a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_enum/post.py +++ /dev/null @@ -1,325 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from petstore_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from petstore_api import schemas # noqa: F401 - -from petstore_api.model.string_enum import StringEnum - -from . import path - -# body param -SchemaForRequestBodyApplicationJson = StringEnum - - -request_body_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, -) -SchemaFor200ResponseBodyApplicationJson = StringEnum - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_status_code_to_response = { - '200': _response_for_200, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _string_enum_oapg( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _string_enum_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _string_enum_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _string_enum_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _string_enum_oapg( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - _fields = None - _body = None - if body is not schemas.unset: - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class StringEnum(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def string_enum( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def string_enum( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def string_enum( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def string_enum( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def string_enum( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._string_enum_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._string_enum_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_enum/post.pyi b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_enum/post.pyi deleted file mode 100644 index ea4b1fe2ff5..00000000000 --- a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_enum/post.pyi +++ /dev/null @@ -1,320 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from petstore_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from petstore_api import schemas # noqa: F401 - -from petstore_api.model.string_enum import StringEnum - -# body param -SchemaForRequestBodyApplicationJson = StringEnum - - -request_body_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, -) -SchemaFor200ResponseBodyApplicationJson = StringEnum - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _string_enum_oapg( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _string_enum_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _string_enum_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _string_enum_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _string_enum_oapg( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - _fields = None - _body = None - if body is not schemas.unset: - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class StringEnum(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def string_enum( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def string_enum( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def string_enum( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def string_enum( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def string_enum( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._string_enum_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._string_enum_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_enum/post/__init__.py b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_enum/post/__init__.py new file mode 100644 index 00000000000..8f03d0c8ecd --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_enum/post/__init__.py @@ -0,0 +1,311 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from petstore_api.model.string_enum import StringEnum + +from .. import path +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = StringEnum + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + ) + +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _string_enum_oapg( + self, + content_type: typing_extensions.Literal["application/json"] = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _string_enum_oapg( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _string_enum_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _string_enum_oapg( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _string_enum_oapg( + self, + content_type: str = 'application/json', + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + _fields = None + _body = None + if body is not schemas.unset: + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class StringEnum(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def string_enum( + self, + content_type: typing_extensions.Literal["application/json"] = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def string_enum( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def string_enum( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def string_enum( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def string_enum( + self, + content_type: str = 'application/json', + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._string_enum_oapg( + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + content_type: typing_extensions.Literal["application/json"] = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + content_type: str = 'application/json', + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._string_enum_oapg( + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_enum/post/__init__.pyi b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_enum/post/__init__.pyi new file mode 100644 index 00000000000..76432aeea5e --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_enum/post/__init__.pyi @@ -0,0 +1,306 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from petstore_api.model.string_enum import StringEnum + +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = StringEnum + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + ) +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _string_enum_oapg( + self, + content_type: typing_extensions.Literal["application/json"] = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _string_enum_oapg( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _string_enum_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _string_enum_oapg( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _string_enum_oapg( + self, + content_type: str = 'application/json', + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + _fields = None + _body = None + if body is not schemas.unset: + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class StringEnum(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def string_enum( + self, + content_type: typing_extensions.Literal["application/json"] = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def string_enum( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def string_enum( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def string_enum( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def string_enum( + self, + content_type: str = 'application/json', + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._string_enum_oapg( + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + content_type: typing_extensions.Literal["application/json"] = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + content_type: str = 'application/json', + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._string_enum_oapg( + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_enum/post/response_for_200.py b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_enum/post/response_for_200.py new file mode 100644 index 00000000000..65a3feee344 --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_enum/post/response_for_200.py @@ -0,0 +1,43 @@ +import dataclasses +import urllib3 + +from petstore_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from petstore_api.model.string_enum import StringEnum + + +class BodySchemas: + # body schemas + application_json = StringEnum + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_mammal/post.py b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_mammal/post.py deleted file mode 100644 index dfeb527472f..00000000000 --- a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_mammal/post.py +++ /dev/null @@ -1,328 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from petstore_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from petstore_api import schemas # noqa: F401 - -from petstore_api.model.mammal import Mammal - -from . import path - -# body param -SchemaForRequestBodyApplicationJson = Mammal - - -request_body_mammal = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) -SchemaFor200ResponseBodyApplicationJson = Mammal - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_status_code_to_response = { - '200': _response_for_200, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _mammal_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _mammal_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _mammal_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _mammal_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _mammal_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_mammal.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class Mammal(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def mammal( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def mammal( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def mammal( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def mammal( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def mammal( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._mammal_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._mammal_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_mammal/post.pyi b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_mammal/post.pyi deleted file mode 100644 index 24137e6fa53..00000000000 --- a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_mammal/post.pyi +++ /dev/null @@ -1,323 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from petstore_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from petstore_api import schemas # noqa: F401 - -from petstore_api.model.mammal import Mammal - -# body param -SchemaForRequestBodyApplicationJson = Mammal - - -request_body_mammal = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) -SchemaFor200ResponseBodyApplicationJson = Mammal - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _mammal_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _mammal_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _mammal_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _mammal_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _mammal_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_mammal.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class Mammal(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def mammal( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def mammal( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def mammal( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def mammal( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def mammal( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._mammal_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._mammal_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_mammal/post/__init__.py b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_mammal/post/__init__.py new file mode 100644 index 00000000000..d9e9f6cc462 --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_mammal/post/__init__.py @@ -0,0 +1,314 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from petstore_api.model.mammal import Mammal + +from .. import path +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = Mammal + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _mammal_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _mammal_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _mammal_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _mammal_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _mammal_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class Mammal(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def mammal( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def mammal( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def mammal( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def mammal( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def mammal( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._mammal_oapg( + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._mammal_oapg( + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_mammal/post/__init__.pyi b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_mammal/post/__init__.pyi new file mode 100644 index 00000000000..a279e0a65a4 --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_mammal/post/__init__.pyi @@ -0,0 +1,309 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from petstore_api.model.mammal import Mammal + +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = Mammal + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _mammal_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _mammal_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _mammal_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _mammal_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _mammal_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class Mammal(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def mammal( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def mammal( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def mammal( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def mammal( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def mammal( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._mammal_oapg( + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._mammal_oapg( + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_mammal/post/response_for_200.py b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_mammal/post/response_for_200.py new file mode 100644 index 00000000000..2fd3e77ef58 --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_mammal/post/response_for_200.py @@ -0,0 +1,43 @@ +import dataclasses +import urllib3 + +from petstore_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from petstore_api.model.mammal import Mammal + + +class BodySchemas: + # body schemas + application_json = Mammal + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_number/post.py b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_number/post.py deleted file mode 100644 index ab8e5088e51..00000000000 --- a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_number/post.py +++ /dev/null @@ -1,325 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from petstore_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from petstore_api import schemas # noqa: F401 - -from petstore_api.model.number_with_validations import NumberWithValidations - -from . import path - -# body param -SchemaForRequestBodyApplicationJson = NumberWithValidations - - -request_body_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, -) -SchemaFor200ResponseBodyApplicationJson = NumberWithValidations - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_status_code_to_response = { - '200': _response_for_200, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _number_with_validations_oapg( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _number_with_validations_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _number_with_validations_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _number_with_validations_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _number_with_validations_oapg( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - _fields = None - _body = None - if body is not schemas.unset: - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class NumberWithValidations(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def number_with_validations( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def number_with_validations( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def number_with_validations( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def number_with_validations( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def number_with_validations( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._number_with_validations_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._number_with_validations_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_number/post.pyi b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_number/post.pyi deleted file mode 100644 index 8fb5defd566..00000000000 --- a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_number/post.pyi +++ /dev/null @@ -1,320 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from petstore_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from petstore_api import schemas # noqa: F401 - -from petstore_api.model.number_with_validations import NumberWithValidations - -# body param -SchemaForRequestBodyApplicationJson = NumberWithValidations - - -request_body_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, -) -SchemaFor200ResponseBodyApplicationJson = NumberWithValidations - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _number_with_validations_oapg( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _number_with_validations_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _number_with_validations_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _number_with_validations_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _number_with_validations_oapg( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - _fields = None - _body = None - if body is not schemas.unset: - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class NumberWithValidations(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def number_with_validations( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def number_with_validations( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def number_with_validations( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def number_with_validations( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def number_with_validations( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._number_with_validations_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._number_with_validations_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_number/post/__init__.py b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_number/post/__init__.py new file mode 100644 index 00000000000..02915fddf42 --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_number/post/__init__.py @@ -0,0 +1,311 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from petstore_api.model.number_with_validations import NumberWithValidations + +from .. import path +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = NumberWithValidations + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + ) + +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _number_with_validations_oapg( + self, + content_type: typing_extensions.Literal["application/json"] = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _number_with_validations_oapg( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _number_with_validations_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _number_with_validations_oapg( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _number_with_validations_oapg( + self, + content_type: str = 'application/json', + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + _fields = None + _body = None + if body is not schemas.unset: + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class NumberWithValidations(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def number_with_validations( + self, + content_type: typing_extensions.Literal["application/json"] = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def number_with_validations( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def number_with_validations( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def number_with_validations( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def number_with_validations( + self, + content_type: str = 'application/json', + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._number_with_validations_oapg( + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + content_type: typing_extensions.Literal["application/json"] = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + content_type: str = 'application/json', + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._number_with_validations_oapg( + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_number/post/__init__.pyi b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_number/post/__init__.pyi new file mode 100644 index 00000000000..ab5aae6b249 --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_number/post/__init__.pyi @@ -0,0 +1,306 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from petstore_api.model.number_with_validations import NumberWithValidations + +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = NumberWithValidations + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + ) +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _number_with_validations_oapg( + self, + content_type: typing_extensions.Literal["application/json"] = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _number_with_validations_oapg( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _number_with_validations_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _number_with_validations_oapg( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _number_with_validations_oapg( + self, + content_type: str = 'application/json', + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + _fields = None + _body = None + if body is not schemas.unset: + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class NumberWithValidations(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def number_with_validations( + self, + content_type: typing_extensions.Literal["application/json"] = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def number_with_validations( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def number_with_validations( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def number_with_validations( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def number_with_validations( + self, + content_type: str = 'application/json', + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._number_with_validations_oapg( + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + content_type: typing_extensions.Literal["application/json"] = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + content_type: str = 'application/json', + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._number_with_validations_oapg( + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_number/post/response_for_200.py b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_number/post/response_for_200.py new file mode 100644 index 00000000000..9d27aded28f --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_number/post/response_for_200.py @@ -0,0 +1,43 @@ +import dataclasses +import urllib3 + +from petstore_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from petstore_api.model.number_with_validations import NumberWithValidations + + +class BodySchemas: + # body schemas + application_json = NumberWithValidations + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_object_model_with_ref_props/post.py b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_object_model_with_ref_props/post.py deleted file mode 100644 index 9df4ea7f154..00000000000 --- a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_object_model_with_ref_props/post.py +++ /dev/null @@ -1,325 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from petstore_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from petstore_api import schemas # noqa: F401 - -from petstore_api.model.object_model_with_ref_props import ObjectModelWithRefProps - -from . import path - -# body param -SchemaForRequestBodyApplicationJson = ObjectModelWithRefProps - - -request_body_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, -) -SchemaFor200ResponseBodyApplicationJson = ObjectModelWithRefProps - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_status_code_to_response = { - '200': _response_for_200, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _object_model_with_ref_props_oapg( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _object_model_with_ref_props_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _object_model_with_ref_props_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _object_model_with_ref_props_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _object_model_with_ref_props_oapg( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - _fields = None - _body = None - if body is not schemas.unset: - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class ObjectModelWithRefProps(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def object_model_with_ref_props( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def object_model_with_ref_props( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def object_model_with_ref_props( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def object_model_with_ref_props( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def object_model_with_ref_props( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._object_model_with_ref_props_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._object_model_with_ref_props_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_object_model_with_ref_props/post.pyi b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_object_model_with_ref_props/post.pyi deleted file mode 100644 index 7ad3021226b..00000000000 --- a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_object_model_with_ref_props/post.pyi +++ /dev/null @@ -1,320 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from petstore_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from petstore_api import schemas # noqa: F401 - -from petstore_api.model.object_model_with_ref_props import ObjectModelWithRefProps - -# body param -SchemaForRequestBodyApplicationJson = ObjectModelWithRefProps - - -request_body_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, -) -SchemaFor200ResponseBodyApplicationJson = ObjectModelWithRefProps - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _object_model_with_ref_props_oapg( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _object_model_with_ref_props_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _object_model_with_ref_props_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _object_model_with_ref_props_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _object_model_with_ref_props_oapg( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - _fields = None - _body = None - if body is not schemas.unset: - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class ObjectModelWithRefProps(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def object_model_with_ref_props( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def object_model_with_ref_props( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def object_model_with_ref_props( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def object_model_with_ref_props( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def object_model_with_ref_props( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._object_model_with_ref_props_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._object_model_with_ref_props_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_object_model_with_ref_props/post/__init__.py b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_object_model_with_ref_props/post/__init__.py new file mode 100644 index 00000000000..777bdc99da7 --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_object_model_with_ref_props/post/__init__.py @@ -0,0 +1,311 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from petstore_api.model.object_model_with_ref_props import ObjectModelWithRefProps + +from .. import path +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = ObjectModelWithRefProps + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + ) + +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _object_model_with_ref_props_oapg( + self, + content_type: typing_extensions.Literal["application/json"] = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _object_model_with_ref_props_oapg( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _object_model_with_ref_props_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _object_model_with_ref_props_oapg( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _object_model_with_ref_props_oapg( + self, + content_type: str = 'application/json', + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + _fields = None + _body = None + if body is not schemas.unset: + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class ObjectModelWithRefProps(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def object_model_with_ref_props( + self, + content_type: typing_extensions.Literal["application/json"] = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def object_model_with_ref_props( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def object_model_with_ref_props( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def object_model_with_ref_props( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def object_model_with_ref_props( + self, + content_type: str = 'application/json', + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._object_model_with_ref_props_oapg( + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + content_type: typing_extensions.Literal["application/json"] = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + content_type: str = 'application/json', + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._object_model_with_ref_props_oapg( + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_object_model_with_ref_props/post/__init__.pyi b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_object_model_with_ref_props/post/__init__.pyi new file mode 100644 index 00000000000..e3e487efa89 --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_object_model_with_ref_props/post/__init__.pyi @@ -0,0 +1,306 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from petstore_api.model.object_model_with_ref_props import ObjectModelWithRefProps + +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = ObjectModelWithRefProps + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + ) +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _object_model_with_ref_props_oapg( + self, + content_type: typing_extensions.Literal["application/json"] = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _object_model_with_ref_props_oapg( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _object_model_with_ref_props_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _object_model_with_ref_props_oapg( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _object_model_with_ref_props_oapg( + self, + content_type: str = 'application/json', + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + _fields = None + _body = None + if body is not schemas.unset: + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class ObjectModelWithRefProps(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def object_model_with_ref_props( + self, + content_type: typing_extensions.Literal["application/json"] = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def object_model_with_ref_props( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def object_model_with_ref_props( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def object_model_with_ref_props( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def object_model_with_ref_props( + self, + content_type: str = 'application/json', + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._object_model_with_ref_props_oapg( + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + content_type: typing_extensions.Literal["application/json"] = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + content_type: str = 'application/json', + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._object_model_with_ref_props_oapg( + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_object_model_with_ref_props/post/response_for_200.py b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_object_model_with_ref_props/post/response_for_200.py new file mode 100644 index 00000000000..24c4fa41ff6 --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_object_model_with_ref_props/post/response_for_200.py @@ -0,0 +1,43 @@ +import dataclasses +import urllib3 + +from petstore_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from petstore_api.model.object_model_with_ref_props import ObjectModelWithRefProps + + +class BodySchemas: + # body schemas + application_json = ObjectModelWithRefProps + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_string/post.py b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_string/post.py deleted file mode 100644 index 6e12c6a77c7..00000000000 --- a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_string/post.py +++ /dev/null @@ -1,323 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from petstore_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from petstore_api import schemas # noqa: F401 - -from . import path - -# body param -SchemaForRequestBodyApplicationJson = schemas.StrSchema - - -request_body_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, -) -SchemaFor200ResponseBodyApplicationJson = schemas.StrSchema - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_status_code_to_response = { - '200': _response_for_200, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _string_oapg( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, str, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _string_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, str, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _string_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, str, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _string_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, str, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _string_oapg( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, str, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - _fields = None - _body = None - if body is not schemas.unset: - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class String(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def string( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, str, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def string( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, str, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def string( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, str, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def string( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, str, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def string( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, str, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._string_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, str, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, str, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, str, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, str, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, str, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._string_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_string/post.pyi b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_string/post.pyi deleted file mode 100644 index 0e7d1fb36c1..00000000000 --- a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_string/post.pyi +++ /dev/null @@ -1,318 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from petstore_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from petstore_api import schemas # noqa: F401 - -# body param -SchemaForRequestBodyApplicationJson = schemas.StrSchema - - -request_body_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, -) -SchemaFor200ResponseBodyApplicationJson = schemas.StrSchema - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _string_oapg( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, str, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _string_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, str, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _string_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, str, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _string_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, str, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _string_oapg( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, str, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - _fields = None - _body = None - if body is not schemas.unset: - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class String(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def string( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, str, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def string( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, str, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def string( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, str, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def string( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, str, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def string( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, str, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._string_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, str, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, str, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, str, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, str, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, str, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._string_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_string/post/__init__.py b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_string/post/__init__.py new file mode 100644 index 00000000000..faacfc29015 --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_string/post/__init__.py @@ -0,0 +1,311 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from petstore_api.model.string import String + +from .. import path +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = String + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + ) + +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _string_oapg( + self, + content_type: typing_extensions.Literal["application/json"] = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _string_oapg( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _string_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _string_oapg( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _string_oapg( + self, + content_type: str = 'application/json', + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + _fields = None + _body = None + if body is not schemas.unset: + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class String(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def string( + self, + content_type: typing_extensions.Literal["application/json"] = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def string( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def string( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def string( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def string( + self, + content_type: str = 'application/json', + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._string_oapg( + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + content_type: typing_extensions.Literal["application/json"] = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + content_type: str = 'application/json', + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._string_oapg( + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_string/post/__init__.pyi b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_string/post/__init__.pyi new file mode 100644 index 00000000000..5e269b88243 --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_string/post/__init__.pyi @@ -0,0 +1,306 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from petstore_api.model.string import String + +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_json = String + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + ) +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _string_oapg( + self, + content_type: typing_extensions.Literal["application/json"] = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _string_oapg( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _string_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _string_oapg( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _string_oapg( + self, + content_type: str = 'application/json', + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + _fields = None + _body = None + if body is not schemas.unset: + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class String(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def string( + self, + content_type: typing_extensions.Literal["application/json"] = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def string( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def string( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def string( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def string( + self, + content_type: str = 'application/json', + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._string_oapg( + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + content_type: typing_extensions.Literal["application/json"] = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + content_type: str = 'application/json', + body: typing.Union[RequestBody.Schemas.application_json, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._string_oapg( + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_string/post/response_for_200.py b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_string/post/response_for_200.py new file mode 100644 index 00000000000..084ff9dca08 --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_refs_string/post/response_for_200.py @@ -0,0 +1,43 @@ +import dataclasses +import urllib3 + +from petstore_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from petstore_api.model.string import String + + +class BodySchemas: + # body schemas + application_json = String + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_response_without_schema/get.py b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_response_without_schema/get.py deleted file mode 100644 index f62d1360ba0..00000000000 --- a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_response_without_schema/get.py +++ /dev/null @@ -1,234 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from petstore_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from petstore_api import schemas # noqa: F401 - -from . import path - - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - schemas.Unset, - schemas.Unset, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType(), - 'application/xml': api_client.MediaType(), - }, -) -_status_code_to_response = { - '200': _response_for_200, -} -_all_accept_content_types = ( - 'application/json', - 'application/xml', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _response_without_schema_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _response_without_schema_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _response_without_schema_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _response_without_schema_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - receives a response without schema - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='get'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class ResponseWithoutSchema(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def response_without_schema( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def response_without_schema( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def response_without_schema( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def response_without_schema( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._response_without_schema_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForget(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def get( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._response_without_schema_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_response_without_schema/get.pyi b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_response_without_schema/get.pyi deleted file mode 100644 index ecb63bdc8e2..00000000000 --- a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_response_without_schema/get.pyi +++ /dev/null @@ -1,229 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from petstore_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from petstore_api import schemas # noqa: F401 - - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - schemas.Unset, - schemas.Unset, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType(), - 'application/xml': api_client.MediaType(), - }, -) -_all_accept_content_types = ( - 'application/json', - 'application/xml', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _response_without_schema_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _response_without_schema_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _response_without_schema_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _response_without_schema_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - receives a response without schema - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='get'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class ResponseWithoutSchema(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def response_without_schema( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def response_without_schema( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def response_without_schema( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def response_without_schema( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._response_without_schema_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForget(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def get( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._response_without_schema_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_response_without_schema/get/__init__.py b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_response_without_schema/get/__init__.py new file mode 100644 index 00000000000..722b724522c --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_response_without_schema/get/__init__.py @@ -0,0 +1,217 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 + + +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/json', + 'application/xml', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _response_without_schema_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _response_without_schema_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _response_without_schema_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _response_without_schema_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + receives a response without schema + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='get'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class ResponseWithoutSchema(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def response_without_schema( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def response_without_schema( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def response_without_schema( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def response_without_schema( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._response_without_schema_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForget(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def get( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def get( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def get( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def get( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._response_without_schema_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_response_without_schema/get/__init__.pyi b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_response_without_schema/get/__init__.pyi new file mode 100644 index 00000000000..05c85e9b0b8 --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_response_without_schema/get/__init__.pyi @@ -0,0 +1,212 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from . import response_for_200 + +_all_accept_content_types = ( + 'application/json', + 'application/xml', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _response_without_schema_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _response_without_schema_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _response_without_schema_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _response_without_schema_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + receives a response without schema + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='get'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class ResponseWithoutSchema(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def response_without_schema( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def response_without_schema( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def response_without_schema( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def response_without_schema( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._response_without_schema_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForget(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def get( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def get( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def get( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def get( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._response_without_schema_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_response_without_schema/get/response_for_200.py b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_response_without_schema/get/response_for_200.py new file mode 100644 index 00000000000..e31f6c2fbbc --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_response_without_schema/get/response_for_200.py @@ -0,0 +1,42 @@ +import dataclasses +import urllib3 + +from petstore_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + + +class BodySchemas: + # body schemas + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + schemas.Unset, + schemas.Unset, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json': api_client.MediaType( + ), + 'application/xml': api_client.MediaType( + ), + }, +) diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_test_query_paramters/put/__init__.py b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_test_query_paramters/put/__init__.py new file mode 100644 index 00000000000..d5f29a0df83 --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_test_query_paramters/put/__init__.py @@ -0,0 +1,404 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from petstore_api.model.string_with_validation import StringWithValidation + +from .. import path +from . import response_for_200 + + + +class RequestQueryParameters: + class Schemas: + + + class pipe( + schemas.ListSchema + ): + + + class MetaOapg: + items = schemas.StrSchema + + def __new__( + cls, + arg: typing.Union[typing.Tuple[typing.Union[MetaOapg.items, str, ]], typing.List[typing.Union[MetaOapg.items, str, ]]], + _configuration: typing.Optional[schemas.Configuration] = None, + ) -> 'pipe': + return super().__new__( + cls, + arg, + _configuration=_configuration, + ) + + def __getitem__(self, i: int) -> MetaOapg.items: + return super().__getitem__(i) + + + class ioutil( + schemas.ListSchema + ): + + + class MetaOapg: + items = schemas.StrSchema + + def __new__( + cls, + arg: typing.Union[typing.Tuple[typing.Union[MetaOapg.items, str, ]], typing.List[typing.Union[MetaOapg.items, str, ]]], + _configuration: typing.Optional[schemas.Configuration] = None, + ) -> 'ioutil': + return super().__new__( + cls, + arg, + _configuration=_configuration, + ) + + def __getitem__(self, i: int) -> MetaOapg.items: + return super().__getitem__(i) + + + class http( + schemas.ListSchema + ): + + + class MetaOapg: + items = schemas.StrSchema + + def __new__( + cls, + arg: typing.Union[typing.Tuple[typing.Union[MetaOapg.items, str, ]], typing.List[typing.Union[MetaOapg.items, str, ]]], + _configuration: typing.Optional[schemas.Configuration] = None, + ) -> 'http': + return super().__new__( + cls, + arg, + _configuration=_configuration, + ) + + def __getitem__(self, i: int) -> MetaOapg.items: + return super().__getitem__(i) + + + class url( + schemas.ListSchema + ): + + + class MetaOapg: + items = schemas.StrSchema + + def __new__( + cls, + arg: typing.Union[typing.Tuple[typing.Union[MetaOapg.items, str, ]], typing.List[typing.Union[MetaOapg.items, str, ]]], + _configuration: typing.Optional[schemas.Configuration] = None, + ) -> 'url': + return super().__new__( + cls, + arg, + _configuration=_configuration, + ) + + def __getitem__(self, i: int) -> MetaOapg.items: + return super().__getitem__(i) + + + class context( + schemas.ListSchema + ): + + + class MetaOapg: + items = schemas.StrSchema + + def __new__( + cls, + arg: typing.Union[typing.Tuple[typing.Union[MetaOapg.items, str, ]], typing.List[typing.Union[MetaOapg.items, str, ]]], + _configuration: typing.Optional[schemas.Configuration] = None, + ) -> 'context': + return super().__new__( + cls, + arg, + _configuration=_configuration, + ) + + def __getitem__(self, i: int) -> MetaOapg.items: + return super().__getitem__(i) + refParam = StringWithValidation + + + RequiredParams = typing_extensions.TypedDict( + 'RequiredParams', + { + 'pipe': typing.Union[Schemas.pipe, list, tuple, ], + 'ioutil': typing.Union[Schemas.ioutil, list, tuple, ], + 'http': typing.Union[Schemas.http, list, tuple, ], + 'url': typing.Union[Schemas.url, list, tuple, ], + 'context': typing.Union[Schemas.context, list, tuple, ], + 'refParam': typing.Union[Schemas.refParam, ], + } + ) + OptionalParams = typing_extensions.TypedDict( + 'OptionalParams', + { + }, + total=False + ) + + + class Params(RequiredParams, OptionalParams): + pass + + + parameters = [ + api_client.QueryParameter( + name="pipe", + style=api_client.ParameterStyle.FORM, + schema=Schemas.pipe, + required=True, + explode=True, + ), + api_client.QueryParameter( + name="ioutil", + style=api_client.ParameterStyle.FORM, + schema=Schemas.ioutil, + required=True, + ), + api_client.QueryParameter( + name="http", + style=api_client.ParameterStyle.SPACE_DELIMITED, + schema=Schemas.http, + required=True, + ), + api_client.QueryParameter( + name="url", + style=api_client.ParameterStyle.FORM, + schema=Schemas.url, + required=True, + ), + api_client.QueryParameter( + name="context", + style=api_client.ParameterStyle.FORM, + schema=Schemas.context, + required=True, + explode=True, + ), + api_client.QueryParameter( + name="refParam", + style=api_client.ParameterStyle.FORM, + schema=Schemas.refParam, + required=True, + explode=True, + ), + ] +_status_code_to_response = { + '200': response_for_200.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _query_parameter_collection_format_oapg( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _query_parameter_collection_format_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _query_parameter_collection_format_oapg( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _query_parameter_collection_format_oapg( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + self._verify_typed_dict_inputs_oapg(RequestQueryParameters.Params, query_params) + used_path = path.value + + prefix_separator_iterator = None + for parameter in RequestQueryParameters.parameters: + parameter_data = query_params.get(parameter.name, schemas.unset) + if parameter_data is schemas.unset: + continue + if prefix_separator_iterator is None: + prefix_separator_iterator = parameter.get_prefix_separator_iterator() + serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) + for serialized_value in serialized_data.values(): + used_path += serialized_value + # TODO add cookie handling + + response = self.api_client.call_api( + resource_path=used_path, + method='put'.upper(), + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class QueryParameterCollectionFormat(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def query_parameter_collection_format( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def query_parameter_collection_format( + self, + skip_deserialization: typing_extensions.Literal[True], + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def query_parameter_collection_format( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def query_parameter_collection_format( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._query_parameter_collection_format_oapg( + query_params=query_params, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForput(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def put( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def put( + self, + skip_deserialization: typing_extensions.Literal[True], + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def put( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def put( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._query_parameter_collection_format_oapg( + query_params=query_params, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_test_query_paramters/put/__init__.pyi b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_test_query_paramters/put/__init__.pyi new file mode 100644 index 00000000000..b9eec8a5a51 --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_test_query_paramters/put/__init__.pyi @@ -0,0 +1,399 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from petstore_api.model.string_with_validation import StringWithValidation + +from . import response_for_200 + + + +class RequestQueryParameters: + class Schemas: + + + class pipe( + schemas.ListSchema + ): + + + class MetaOapg: + items = schemas.StrSchema + + def __new__( + cls, + arg: typing.Union[typing.Tuple[typing.Union[MetaOapg.items, str, ]], typing.List[typing.Union[MetaOapg.items, str, ]]], + _configuration: typing.Optional[schemas.Configuration] = None, + ) -> 'pipe': + return super().__new__( + cls, + arg, + _configuration=_configuration, + ) + + def __getitem__(self, i: int) -> MetaOapg.items: + return super().__getitem__(i) + + + class ioutil( + schemas.ListSchema + ): + + + class MetaOapg: + items = schemas.StrSchema + + def __new__( + cls, + arg: typing.Union[typing.Tuple[typing.Union[MetaOapg.items, str, ]], typing.List[typing.Union[MetaOapg.items, str, ]]], + _configuration: typing.Optional[schemas.Configuration] = None, + ) -> 'ioutil': + return super().__new__( + cls, + arg, + _configuration=_configuration, + ) + + def __getitem__(self, i: int) -> MetaOapg.items: + return super().__getitem__(i) + + + class http( + schemas.ListSchema + ): + + + class MetaOapg: + items = schemas.StrSchema + + def __new__( + cls, + arg: typing.Union[typing.Tuple[typing.Union[MetaOapg.items, str, ]], typing.List[typing.Union[MetaOapg.items, str, ]]], + _configuration: typing.Optional[schemas.Configuration] = None, + ) -> 'http': + return super().__new__( + cls, + arg, + _configuration=_configuration, + ) + + def __getitem__(self, i: int) -> MetaOapg.items: + return super().__getitem__(i) + + + class url( + schemas.ListSchema + ): + + + class MetaOapg: + items = schemas.StrSchema + + def __new__( + cls, + arg: typing.Union[typing.Tuple[typing.Union[MetaOapg.items, str, ]], typing.List[typing.Union[MetaOapg.items, str, ]]], + _configuration: typing.Optional[schemas.Configuration] = None, + ) -> 'url': + return super().__new__( + cls, + arg, + _configuration=_configuration, + ) + + def __getitem__(self, i: int) -> MetaOapg.items: + return super().__getitem__(i) + + + class context( + schemas.ListSchema + ): + + + class MetaOapg: + items = schemas.StrSchema + + def __new__( + cls, + arg: typing.Union[typing.Tuple[typing.Union[MetaOapg.items, str, ]], typing.List[typing.Union[MetaOapg.items, str, ]]], + _configuration: typing.Optional[schemas.Configuration] = None, + ) -> 'context': + return super().__new__( + cls, + arg, + _configuration=_configuration, + ) + + def __getitem__(self, i: int) -> MetaOapg.items: + return super().__getitem__(i) + refParam = StringWithValidation + + + RequiredParams = typing_extensions.TypedDict( + 'RequiredParams', + { + 'pipe': typing.Union[Schemas.pipe, list, tuple, ], + 'ioutil': typing.Union[Schemas.ioutil, list, tuple, ], + 'http': typing.Union[Schemas.http, list, tuple, ], + 'url': typing.Union[Schemas.url, list, tuple, ], + 'context': typing.Union[Schemas.context, list, tuple, ], + 'refParam': typing.Union[Schemas.refParam, ], + } + ) + OptionalParams = typing_extensions.TypedDict( + 'OptionalParams', + { + }, + total=False + ) + + + class Params(RequiredParams, OptionalParams): + pass + + + parameters = [ + api_client.QueryParameter( + name="pipe", + style=api_client.ParameterStyle.FORM, + schema=Schemas.pipe, + required=True, + explode=True, + ), + api_client.QueryParameter( + name="ioutil", + style=api_client.ParameterStyle.FORM, + schema=Schemas.ioutil, + required=True, + ), + api_client.QueryParameter( + name="http", + style=api_client.ParameterStyle.SPACE_DELIMITED, + schema=Schemas.http, + required=True, + ), + api_client.QueryParameter( + name="url", + style=api_client.ParameterStyle.FORM, + schema=Schemas.url, + required=True, + ), + api_client.QueryParameter( + name="context", + style=api_client.ParameterStyle.FORM, + schema=Schemas.context, + required=True, + explode=True, + ), + api_client.QueryParameter( + name="refParam", + style=api_client.ParameterStyle.FORM, + schema=Schemas.refParam, + required=True, + explode=True, + ), + ] + +class BaseApi(api_client.Api): + @typing.overload + def _query_parameter_collection_format_oapg( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _query_parameter_collection_format_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _query_parameter_collection_format_oapg( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _query_parameter_collection_format_oapg( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + self._verify_typed_dict_inputs_oapg(RequestQueryParameters.Params, query_params) + used_path = path.value + + prefix_separator_iterator = None + for parameter in RequestQueryParameters.parameters: + parameter_data = query_params.get(parameter.name, schemas.unset) + if parameter_data is schemas.unset: + continue + if prefix_separator_iterator is None: + prefix_separator_iterator = parameter.get_prefix_separator_iterator() + serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) + for serialized_value in serialized_data.values(): + used_path += serialized_value + # TODO add cookie handling + + response = self.api_client.call_api( + resource_path=used_path, + method='put'.upper(), + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class QueryParameterCollectionFormat(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def query_parameter_collection_format( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def query_parameter_collection_format( + self, + skip_deserialization: typing_extensions.Literal[True], + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def query_parameter_collection_format( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def query_parameter_collection_format( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._query_parameter_collection_format_oapg( + query_params=query_params, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForput(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def put( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def put( + self, + skip_deserialization: typing_extensions.Literal[True], + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def put( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def put( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._query_parameter_collection_format_oapg( + query_params=query_params, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_test_query_paramters/put/response_for_200.py b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_test_query_paramters/put/response_for_200.py new file mode 100644 index 00000000000..7ec95a8627a --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_test_query_paramters/put/response_for_200.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from petstore_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_upload_download_file/post.py b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_upload_download_file/post.py deleted file mode 100644 index 9686e6ede5c..00000000000 --- a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_upload_download_file/post.py +++ /dev/null @@ -1,327 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from petstore_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from petstore_api import schemas # noqa: F401 - -from . import path - -# body param -SchemaForRequestBodyApplicationOctetStream = schemas.BinarySchema - - -request_body_body = api_client.RequestBody( - content={ - 'application/octet-stream': api_client.MediaType( - schema=SchemaForRequestBodyApplicationOctetStream), - }, - required=True, -) -SchemaFor200ResponseBodyApplicationOctetStream = schemas.BinarySchema - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationOctetStream, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/octet-stream': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationOctetStream), - }, -) -_status_code_to_response = { - '200': _response_for_200, -} -_all_accept_content_types = ( - 'application/octet-stream', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _upload_download_file_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationOctetStream,bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/octet-stream"] = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _upload_download_file_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationOctetStream,bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _upload_download_file_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationOctetStream,bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _upload_download_file_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationOctetStream,bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _upload_download_file_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationOctetStream,bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/octet-stream', - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - uploads a file and downloads a file using application/octet-stream - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class UploadDownloadFile(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def upload_download_file( - self, - body: typing.Union[SchemaForRequestBodyApplicationOctetStream,bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/octet-stream"] = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def upload_download_file( - self, - body: typing.Union[SchemaForRequestBodyApplicationOctetStream,bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def upload_download_file( - self, - body: typing.Union[SchemaForRequestBodyApplicationOctetStream,bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def upload_download_file( - self, - body: typing.Union[SchemaForRequestBodyApplicationOctetStream,bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def upload_download_file( - self, - body: typing.Union[SchemaForRequestBodyApplicationOctetStream,bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/octet-stream', - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._upload_download_file_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationOctetStream,bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/octet-stream"] = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationOctetStream,bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationOctetStream,bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationOctetStream,bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationOctetStream,bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/octet-stream', - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._upload_download_file_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_upload_download_file/post.pyi b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_upload_download_file/post.pyi deleted file mode 100644 index a6086fbd0d9..00000000000 --- a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_upload_download_file/post.pyi +++ /dev/null @@ -1,322 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from petstore_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from petstore_api import schemas # noqa: F401 - -# body param -SchemaForRequestBodyApplicationOctetStream = schemas.BinarySchema - - -request_body_body = api_client.RequestBody( - content={ - 'application/octet-stream': api_client.MediaType( - schema=SchemaForRequestBodyApplicationOctetStream), - }, - required=True, -) -SchemaFor200ResponseBodyApplicationOctetStream = schemas.BinarySchema - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationOctetStream, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/octet-stream': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationOctetStream), - }, -) -_all_accept_content_types = ( - 'application/octet-stream', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _upload_download_file_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationOctetStream,bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/octet-stream"] = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _upload_download_file_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationOctetStream,bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _upload_download_file_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationOctetStream,bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _upload_download_file_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationOctetStream,bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _upload_download_file_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationOctetStream,bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/octet-stream', - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - uploads a file and downloads a file using application/octet-stream - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class UploadDownloadFile(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def upload_download_file( - self, - body: typing.Union[SchemaForRequestBodyApplicationOctetStream,bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/octet-stream"] = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def upload_download_file( - self, - body: typing.Union[SchemaForRequestBodyApplicationOctetStream,bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def upload_download_file( - self, - body: typing.Union[SchemaForRequestBodyApplicationOctetStream,bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def upload_download_file( - self, - body: typing.Union[SchemaForRequestBodyApplicationOctetStream,bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def upload_download_file( - self, - body: typing.Union[SchemaForRequestBodyApplicationOctetStream,bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/octet-stream', - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._upload_download_file_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationOctetStream,bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/octet-stream"] = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationOctetStream,bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationOctetStream,bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationOctetStream,bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationOctetStream,bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/octet-stream', - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._upload_download_file_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_upload_download_file/post/__init__.py b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_upload_download_file/post/__init__.py new file mode 100644 index 00000000000..c9ccdb31147 --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_upload_download_file/post/__init__.py @@ -0,0 +1,313 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_octet_stream = schemas.BinarySchema + + parameter = api_client.RequestBody( + content={ + 'application/octet-stream': api_client.MediaType( + schema=Schemas.application_octet_stream + ), + }, + required=True, + ) + +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/octet-stream', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _upload_download_file_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_octet_stream,bytes, io.FileIO, io.BufferedReader, ], + content_type: typing_extensions.Literal["application/octet-stream"] = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _upload_download_file_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_octet_stream,bytes, io.FileIO, io.BufferedReader, ], + content_type: str = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _upload_download_file_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_octet_stream,bytes, io.FileIO, io.BufferedReader, ], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _upload_download_file_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_octet_stream,bytes, io.FileIO, io.BufferedReader, ], + content_type: str = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _upload_download_file_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_octet_stream,bytes, io.FileIO, io.BufferedReader, ], + content_type: str = 'application/octet-stream', + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + uploads a file and downloads a file using application/octet-stream + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class UploadDownloadFile(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def upload_download_file( + self, + body: typing.Union[RequestBody.Schemas.application_octet_stream,bytes, io.FileIO, io.BufferedReader, ], + content_type: typing_extensions.Literal["application/octet-stream"] = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def upload_download_file( + self, + body: typing.Union[RequestBody.Schemas.application_octet_stream,bytes, io.FileIO, io.BufferedReader, ], + content_type: str = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def upload_download_file( + self, + body: typing.Union[RequestBody.Schemas.application_octet_stream,bytes, io.FileIO, io.BufferedReader, ], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def upload_download_file( + self, + body: typing.Union[RequestBody.Schemas.application_octet_stream,bytes, io.FileIO, io.BufferedReader, ], + content_type: str = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def upload_download_file( + self, + body: typing.Union[RequestBody.Schemas.application_octet_stream,bytes, io.FileIO, io.BufferedReader, ], + content_type: str = 'application/octet-stream', + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._upload_download_file_oapg( + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_octet_stream,bytes, io.FileIO, io.BufferedReader, ], + content_type: typing_extensions.Literal["application/octet-stream"] = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_octet_stream,bytes, io.FileIO, io.BufferedReader, ], + content_type: str = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_octet_stream,bytes, io.FileIO, io.BufferedReader, ], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_octet_stream,bytes, io.FileIO, io.BufferedReader, ], + content_type: str = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_octet_stream,bytes, io.FileIO, io.BufferedReader, ], + content_type: str = 'application/octet-stream', + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._upload_download_file_oapg( + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_upload_download_file/post/__init__.pyi b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_upload_download_file/post/__init__.pyi new file mode 100644 index 00000000000..eab65e6c7c9 --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_upload_download_file/post/__init__.pyi @@ -0,0 +1,308 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from . import response_for_200 + + + +class RequestBody: + class Schemas: + application_octet_stream = schemas.BinarySchema + + parameter = api_client.RequestBody( + content={ + 'application/octet-stream': api_client.MediaType( + schema=Schemas.application_octet_stream + ), + }, + required=True, + ) +_all_accept_content_types = ( + 'application/octet-stream', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _upload_download_file_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_octet_stream,bytes, io.FileIO, io.BufferedReader, ], + content_type: typing_extensions.Literal["application/octet-stream"] = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _upload_download_file_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_octet_stream,bytes, io.FileIO, io.BufferedReader, ], + content_type: str = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _upload_download_file_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_octet_stream,bytes, io.FileIO, io.BufferedReader, ], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _upload_download_file_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_octet_stream,bytes, io.FileIO, io.BufferedReader, ], + content_type: str = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _upload_download_file_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_octet_stream,bytes, io.FileIO, io.BufferedReader, ], + content_type: str = 'application/octet-stream', + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + uploads a file and downloads a file using application/octet-stream + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class UploadDownloadFile(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def upload_download_file( + self, + body: typing.Union[RequestBody.Schemas.application_octet_stream,bytes, io.FileIO, io.BufferedReader, ], + content_type: typing_extensions.Literal["application/octet-stream"] = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def upload_download_file( + self, + body: typing.Union[RequestBody.Schemas.application_octet_stream,bytes, io.FileIO, io.BufferedReader, ], + content_type: str = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def upload_download_file( + self, + body: typing.Union[RequestBody.Schemas.application_octet_stream,bytes, io.FileIO, io.BufferedReader, ], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def upload_download_file( + self, + body: typing.Union[RequestBody.Schemas.application_octet_stream,bytes, io.FileIO, io.BufferedReader, ], + content_type: str = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def upload_download_file( + self, + body: typing.Union[RequestBody.Schemas.application_octet_stream,bytes, io.FileIO, io.BufferedReader, ], + content_type: str = 'application/octet-stream', + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._upload_download_file_oapg( + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_octet_stream,bytes, io.FileIO, io.BufferedReader, ], + content_type: typing_extensions.Literal["application/octet-stream"] = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_octet_stream,bytes, io.FileIO, io.BufferedReader, ], + content_type: str = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_octet_stream,bytes, io.FileIO, io.BufferedReader, ], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_octet_stream,bytes, io.FileIO, io.BufferedReader, ], + content_type: str = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_octet_stream,bytes, io.FileIO, io.BufferedReader, ], + content_type: str = 'application/octet-stream', + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._upload_download_file_oapg( + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_upload_download_file/post/response_for_200.py b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_upload_download_file/post/response_for_200.py new file mode 100644 index 00000000000..d2427b782b5 --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_upload_download_file/post/response_for_200.py @@ -0,0 +1,41 @@ +import dataclasses +import urllib3 + +from petstore_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + + +class BodySchemas: + # body schemas + application_octet_stream = schemas.BinarySchema + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_octet_stream, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/octet-stream': api_client.MediaType( + schema=BodySchemas.application_octet_stream, + ), + }, +) diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_upload_file/post.py b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_upload_file/post.py deleted file mode 100644 index 867654e95f3..00000000000 --- a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_upload_file/post.py +++ /dev/null @@ -1,390 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from petstore_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from petstore_api import schemas # noqa: F401 - -from petstore_api.model.api_response import ApiResponse - -from . import path - -# body param - - -class SchemaForRequestBodyMultipartFormData( - schemas.DictSchema -): - - - class MetaOapg: - required = { - "file", - } - - class properties: - additionalMetadata = schemas.StrSchema - file = schemas.BinarySchema - __annotations__ = { - "additionalMetadata": additionalMetadata, - "file": file, - } - - file: MetaOapg.properties.file - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["additionalMetadata"]) -> MetaOapg.properties.additionalMetadata: ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["file"]) -> MetaOapg.properties.file: ... - - @typing.overload - def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... - - def __getitem__(self, name: typing.Union[typing_extensions.Literal["additionalMetadata", "file", ], str]): - # dict_instance[name] accessor - return super().__getitem__(name) - - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["additionalMetadata"]) -> typing.Union[MetaOapg.properties.additionalMetadata, schemas.Unset]: ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["file"]) -> MetaOapg.properties.file: ... - - @typing.overload - def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... - - def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["additionalMetadata", "file", ], str]): - return super().get_item_oapg(name) - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, ], - file: typing.Union[MetaOapg.properties.file, bytes, io.FileIO, io.BufferedReader, ], - additionalMetadata: typing.Union[MetaOapg.properties.additionalMetadata, str, schemas.Unset] = schemas.unset, - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'SchemaForRequestBodyMultipartFormData': - return super().__new__( - cls, - *args, - file=file, - additionalMetadata=additionalMetadata, - _configuration=_configuration, - **kwargs, - ) - - -request_body_body = api_client.RequestBody( - content={ - 'multipart/form-data': api_client.MediaType( - schema=SchemaForRequestBodyMultipartFormData), - }, -) -SchemaFor200ResponseBodyApplicationJson = ApiResponse - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_status_code_to_response = { - '200': _response_for_200, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _upload_file_oapg( - self, - content_type: typing_extensions.Literal["multipart/form-data"] = ..., - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _upload_file_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _upload_file_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _upload_file_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _upload_file_oapg( - self, - content_type: str = 'multipart/form-data', - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - uploads a file using multipart/form-data - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - _fields = None - _body = None - if body is not schemas.unset: - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class UploadFile(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def upload_file( - self, - content_type: typing_extensions.Literal["multipart/form-data"] = ..., - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def upload_file( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def upload_file( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def upload_file( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def upload_file( - self, - content_type: str = 'multipart/form-data', - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._upload_file_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - content_type: typing_extensions.Literal["multipart/form-data"] = ..., - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - content_type: str = 'multipart/form-data', - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._upload_file_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_upload_file/post.pyi b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_upload_file/post.pyi deleted file mode 100644 index c77969fbf70..00000000000 --- a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_upload_file/post.pyi +++ /dev/null @@ -1,385 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from petstore_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from petstore_api import schemas # noqa: F401 - -from petstore_api.model.api_response import ApiResponse - -# body param - - -class SchemaForRequestBodyMultipartFormData( - schemas.DictSchema -): - - - class MetaOapg: - required = { - "file", - } - - class properties: - additionalMetadata = schemas.StrSchema - file = schemas.BinarySchema - __annotations__ = { - "additionalMetadata": additionalMetadata, - "file": file, - } - - file: MetaOapg.properties.file - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["additionalMetadata"]) -> MetaOapg.properties.additionalMetadata: ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["file"]) -> MetaOapg.properties.file: ... - - @typing.overload - def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... - - def __getitem__(self, name: typing.Union[typing_extensions.Literal["additionalMetadata", "file", ], str]): - # dict_instance[name] accessor - return super().__getitem__(name) - - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["additionalMetadata"]) -> typing.Union[MetaOapg.properties.additionalMetadata, schemas.Unset]: ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["file"]) -> MetaOapg.properties.file: ... - - @typing.overload - def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... - - def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["additionalMetadata", "file", ], str]): - return super().get_item_oapg(name) - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, ], - file: typing.Union[MetaOapg.properties.file, bytes, io.FileIO, io.BufferedReader, ], - additionalMetadata: typing.Union[MetaOapg.properties.additionalMetadata, str, schemas.Unset] = schemas.unset, - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'SchemaForRequestBodyMultipartFormData': - return super().__new__( - cls, - *args, - file=file, - additionalMetadata=additionalMetadata, - _configuration=_configuration, - **kwargs, - ) - - -request_body_body = api_client.RequestBody( - content={ - 'multipart/form-data': api_client.MediaType( - schema=SchemaForRequestBodyMultipartFormData), - }, -) -SchemaFor200ResponseBodyApplicationJson = ApiResponse - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _upload_file_oapg( - self, - content_type: typing_extensions.Literal["multipart/form-data"] = ..., - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _upload_file_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _upload_file_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _upload_file_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _upload_file_oapg( - self, - content_type: str = 'multipart/form-data', - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - uploads a file using multipart/form-data - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - _fields = None - _body = None - if body is not schemas.unset: - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class UploadFile(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def upload_file( - self, - content_type: typing_extensions.Literal["multipart/form-data"] = ..., - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def upload_file( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def upload_file( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def upload_file( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def upload_file( - self, - content_type: str = 'multipart/form-data', - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._upload_file_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - content_type: typing_extensions.Literal["multipart/form-data"] = ..., - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - content_type: str = 'multipart/form-data', - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._upload_file_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_upload_file/post/__init__.py b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_upload_file/post/__init__.py new file mode 100644 index 00000000000..0b40b9a1edb --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_upload_file/post/__init__.py @@ -0,0 +1,374 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 + + + +class RequestBody: + class Schemas: + + + class multipart_form_data( + schemas.DictSchema + ): + + + class MetaOapg: + required = { + "file", + } + + class properties: + additionalMetadata = schemas.StrSchema + file = schemas.BinarySchema + __annotations__ = { + "additionalMetadata": additionalMetadata, + "file": file, + } + + file: MetaOapg.properties.file + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["additionalMetadata"]) -> MetaOapg.properties.additionalMetadata: ... + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["file"]) -> MetaOapg.properties.file: ... + + @typing.overload + def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... + + def __getitem__(self, name: typing.Union[typing_extensions.Literal["additionalMetadata", "file", ], str]): + # dict_instance[name] accessor + return super().__getitem__(name) + + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["additionalMetadata"]) -> typing.Union[MetaOapg.properties.additionalMetadata, schemas.Unset]: ... + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["file"]) -> MetaOapg.properties.file: ... + + @typing.overload + def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... + + def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["additionalMetadata", "file", ], str]): + return super().get_item_oapg(name) + + + def __new__( + cls, + *args: typing.Union[dict, frozendict.frozendict, ], + file: typing.Union[MetaOapg.properties.file, bytes, io.FileIO, io.BufferedReader, ], + additionalMetadata: typing.Union[MetaOapg.properties.additionalMetadata, str, schemas.Unset] = schemas.unset, + _configuration: typing.Optional[schemas.Configuration] = None, + **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], + ) -> 'multipart_form_data': + return super().__new__( + cls, + *args, + file=file, + additionalMetadata=additionalMetadata, + _configuration=_configuration, + **kwargs, + ) + + parameter = api_client.RequestBody( + content={ + 'multipart/form-data': api_client.MediaType( + schema=Schemas.multipart_form_data + ), + }, + ) + +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _upload_file_oapg( + self, + content_type: typing_extensions.Literal["multipart/form-data"] = ..., + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _upload_file_oapg( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _upload_file_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _upload_file_oapg( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _upload_file_oapg( + self, + content_type: str = 'multipart/form-data', + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + uploads a file using multipart/form-data + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + _fields = None + _body = None + if body is not schemas.unset: + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class UploadFile(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def upload_file( + self, + content_type: typing_extensions.Literal["multipart/form-data"] = ..., + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def upload_file( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def upload_file( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def upload_file( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def upload_file( + self, + content_type: str = 'multipart/form-data', + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._upload_file_oapg( + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + content_type: typing_extensions.Literal["multipart/form-data"] = ..., + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + content_type: str = 'multipart/form-data', + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._upload_file_oapg( + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_upload_file/post/__init__.pyi b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_upload_file/post/__init__.pyi new file mode 100644 index 00000000000..b96a31b06dd --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_upload_file/post/__init__.pyi @@ -0,0 +1,369 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from . import response_for_200 + + + +class RequestBody: + class Schemas: + + + class multipart_form_data( + schemas.DictSchema + ): + + + class MetaOapg: + required = { + "file", + } + + class properties: + additionalMetadata = schemas.StrSchema + file = schemas.BinarySchema + __annotations__ = { + "additionalMetadata": additionalMetadata, + "file": file, + } + + file: MetaOapg.properties.file + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["additionalMetadata"]) -> MetaOapg.properties.additionalMetadata: ... + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["file"]) -> MetaOapg.properties.file: ... + + @typing.overload + def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... + + def __getitem__(self, name: typing.Union[typing_extensions.Literal["additionalMetadata", "file", ], str]): + # dict_instance[name] accessor + return super().__getitem__(name) + + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["additionalMetadata"]) -> typing.Union[MetaOapg.properties.additionalMetadata, schemas.Unset]: ... + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["file"]) -> MetaOapg.properties.file: ... + + @typing.overload + def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... + + def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["additionalMetadata", "file", ], str]): + return super().get_item_oapg(name) + + + def __new__( + cls, + *args: typing.Union[dict, frozendict.frozendict, ], + file: typing.Union[MetaOapg.properties.file, bytes, io.FileIO, io.BufferedReader, ], + additionalMetadata: typing.Union[MetaOapg.properties.additionalMetadata, str, schemas.Unset] = schemas.unset, + _configuration: typing.Optional[schemas.Configuration] = None, + **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], + ) -> 'multipart_form_data': + return super().__new__( + cls, + *args, + file=file, + additionalMetadata=additionalMetadata, + _configuration=_configuration, + **kwargs, + ) + + parameter = api_client.RequestBody( + content={ + 'multipart/form-data': api_client.MediaType( + schema=Schemas.multipart_form_data + ), + }, + ) +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _upload_file_oapg( + self, + content_type: typing_extensions.Literal["multipart/form-data"] = ..., + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _upload_file_oapg( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _upload_file_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _upload_file_oapg( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _upload_file_oapg( + self, + content_type: str = 'multipart/form-data', + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + uploads a file using multipart/form-data + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + _fields = None + _body = None + if body is not schemas.unset: + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class UploadFile(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def upload_file( + self, + content_type: typing_extensions.Literal["multipart/form-data"] = ..., + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def upload_file( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def upload_file( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def upload_file( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def upload_file( + self, + content_type: str = 'multipart/form-data', + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._upload_file_oapg( + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + content_type: typing_extensions.Literal["multipart/form-data"] = ..., + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + content_type: str = 'multipart/form-data', + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._upload_file_oapg( + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_upload_file/post/response_for_200.py b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_upload_file/post/response_for_200.py new file mode 100644 index 00000000000..55c94e2ea12 --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_upload_file/post/response_for_200.py @@ -0,0 +1,43 @@ +import dataclasses +import urllib3 + +from petstore_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from petstore_api.model.api_response import ApiResponse + + +class BodySchemas: + # body schemas + application_json = ApiResponse + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_upload_files/post.py b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_upload_files/post.py deleted file mode 100644 index 4284b0119ce..00000000000 --- a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_upload_files/post.py +++ /dev/null @@ -1,397 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from petstore_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from petstore_api import schemas # noqa: F401 - -from petstore_api.model.api_response import ApiResponse - -from . import path - -# body param - - -class SchemaForRequestBodyMultipartFormData( - schemas.DictSchema -): - - - class MetaOapg: - - class properties: - - - class files( - schemas.ListSchema - ): - - - class MetaOapg: - items = schemas.BinarySchema - - def __new__( - cls, - arg: typing.Union[typing.Tuple[typing.Union[MetaOapg.items, bytes, io.FileIO, io.BufferedReader, ]], typing.List[typing.Union[MetaOapg.items, bytes, io.FileIO, io.BufferedReader, ]]], - _configuration: typing.Optional[schemas.Configuration] = None, - ) -> 'files': - return super().__new__( - cls, - arg, - _configuration=_configuration, - ) - - def __getitem__(self, i: int) -> MetaOapg.items: - return super().__getitem__(i) - __annotations__ = { - "files": files, - } - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["files"]) -> MetaOapg.properties.files: ... - - @typing.overload - def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... - - def __getitem__(self, name: typing.Union[typing_extensions.Literal["files", ], str]): - # dict_instance[name] accessor - return super().__getitem__(name) - - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["files"]) -> typing.Union[MetaOapg.properties.files, schemas.Unset]: ... - - @typing.overload - def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... - - def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["files", ], str]): - return super().get_item_oapg(name) - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, ], - files: typing.Union[MetaOapg.properties.files, list, tuple, schemas.Unset] = schemas.unset, - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'SchemaForRequestBodyMultipartFormData': - return super().__new__( - cls, - *args, - files=files, - _configuration=_configuration, - **kwargs, - ) - - -request_body_body = api_client.RequestBody( - content={ - 'multipart/form-data': api_client.MediaType( - schema=SchemaForRequestBodyMultipartFormData), - }, -) -SchemaFor200ResponseBodyApplicationJson = ApiResponse - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_status_code_to_response = { - '200': _response_for_200, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _upload_files_oapg( - self, - content_type: typing_extensions.Literal["multipart/form-data"] = ..., - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _upload_files_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _upload_files_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _upload_files_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _upload_files_oapg( - self, - content_type: str = 'multipart/form-data', - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - uploads files using multipart/form-data - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - _fields = None - _body = None - if body is not schemas.unset: - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class UploadFiles(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def upload_files( - self, - content_type: typing_extensions.Literal["multipart/form-data"] = ..., - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def upload_files( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def upload_files( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def upload_files( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def upload_files( - self, - content_type: str = 'multipart/form-data', - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._upload_files_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - content_type: typing_extensions.Literal["multipart/form-data"] = ..., - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - content_type: str = 'multipart/form-data', - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._upload_files_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_upload_files/post.pyi b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_upload_files/post.pyi deleted file mode 100644 index 2b1e1f508f3..00000000000 --- a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_upload_files/post.pyi +++ /dev/null @@ -1,392 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from petstore_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from petstore_api import schemas # noqa: F401 - -from petstore_api.model.api_response import ApiResponse - -# body param - - -class SchemaForRequestBodyMultipartFormData( - schemas.DictSchema -): - - - class MetaOapg: - - class properties: - - - class files( - schemas.ListSchema - ): - - - class MetaOapg: - items = schemas.BinarySchema - - def __new__( - cls, - arg: typing.Union[typing.Tuple[typing.Union[MetaOapg.items, bytes, io.FileIO, io.BufferedReader, ]], typing.List[typing.Union[MetaOapg.items, bytes, io.FileIO, io.BufferedReader, ]]], - _configuration: typing.Optional[schemas.Configuration] = None, - ) -> 'files': - return super().__new__( - cls, - arg, - _configuration=_configuration, - ) - - def __getitem__(self, i: int) -> MetaOapg.items: - return super().__getitem__(i) - __annotations__ = { - "files": files, - } - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["files"]) -> MetaOapg.properties.files: ... - - @typing.overload - def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... - - def __getitem__(self, name: typing.Union[typing_extensions.Literal["files", ], str]): - # dict_instance[name] accessor - return super().__getitem__(name) - - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["files"]) -> typing.Union[MetaOapg.properties.files, schemas.Unset]: ... - - @typing.overload - def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... - - def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["files", ], str]): - return super().get_item_oapg(name) - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, ], - files: typing.Union[MetaOapg.properties.files, list, tuple, schemas.Unset] = schemas.unset, - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'SchemaForRequestBodyMultipartFormData': - return super().__new__( - cls, - *args, - files=files, - _configuration=_configuration, - **kwargs, - ) - - -request_body_body = api_client.RequestBody( - content={ - 'multipart/form-data': api_client.MediaType( - schema=SchemaForRequestBodyMultipartFormData), - }, -) -SchemaFor200ResponseBodyApplicationJson = ApiResponse - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _upload_files_oapg( - self, - content_type: typing_extensions.Literal["multipart/form-data"] = ..., - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _upload_files_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _upload_files_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _upload_files_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _upload_files_oapg( - self, - content_type: str = 'multipart/form-data', - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - uploads files using multipart/form-data - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - _fields = None - _body = None - if body is not schemas.unset: - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class UploadFiles(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def upload_files( - self, - content_type: typing_extensions.Literal["multipart/form-data"] = ..., - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def upload_files( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def upload_files( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def upload_files( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def upload_files( - self, - content_type: str = 'multipart/form-data', - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._upload_files_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - content_type: typing_extensions.Literal["multipart/form-data"] = ..., - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - content_type: str = 'multipart/form-data', - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._upload_files_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_upload_files/post/__init__.py b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_upload_files/post/__init__.py new file mode 100644 index 00000000000..c44aa625c78 --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_upload_files/post/__init__.py @@ -0,0 +1,381 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 + + + +class RequestBody: + class Schemas: + + + class multipart_form_data( + schemas.DictSchema + ): + + + class MetaOapg: + + class properties: + + + class files( + schemas.ListSchema + ): + + + class MetaOapg: + items = schemas.BinarySchema + + def __new__( + cls, + arg: typing.Union[typing.Tuple[typing.Union[MetaOapg.items, bytes, io.FileIO, io.BufferedReader, ]], typing.List[typing.Union[MetaOapg.items, bytes, io.FileIO, io.BufferedReader, ]]], + _configuration: typing.Optional[schemas.Configuration] = None, + ) -> 'files': + return super().__new__( + cls, + arg, + _configuration=_configuration, + ) + + def __getitem__(self, i: int) -> MetaOapg.items: + return super().__getitem__(i) + __annotations__ = { + "files": files, + } + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["files"]) -> MetaOapg.properties.files: ... + + @typing.overload + def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... + + def __getitem__(self, name: typing.Union[typing_extensions.Literal["files", ], str]): + # dict_instance[name] accessor + return super().__getitem__(name) + + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["files"]) -> typing.Union[MetaOapg.properties.files, schemas.Unset]: ... + + @typing.overload + def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... + + def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["files", ], str]): + return super().get_item_oapg(name) + + + def __new__( + cls, + *args: typing.Union[dict, frozendict.frozendict, ], + files: typing.Union[MetaOapg.properties.files, list, tuple, schemas.Unset] = schemas.unset, + _configuration: typing.Optional[schemas.Configuration] = None, + **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], + ) -> 'multipart_form_data': + return super().__new__( + cls, + *args, + files=files, + _configuration=_configuration, + **kwargs, + ) + + parameter = api_client.RequestBody( + content={ + 'multipart/form-data': api_client.MediaType( + schema=Schemas.multipart_form_data + ), + }, + ) + +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _upload_files_oapg( + self, + content_type: typing_extensions.Literal["multipart/form-data"] = ..., + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _upload_files_oapg( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _upload_files_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _upload_files_oapg( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _upload_files_oapg( + self, + content_type: str = 'multipart/form-data', + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + uploads files using multipart/form-data + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + _fields = None + _body = None + if body is not schemas.unset: + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class UploadFiles(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def upload_files( + self, + content_type: typing_extensions.Literal["multipart/form-data"] = ..., + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def upload_files( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def upload_files( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def upload_files( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def upload_files( + self, + content_type: str = 'multipart/form-data', + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._upload_files_oapg( + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + content_type: typing_extensions.Literal["multipart/form-data"] = ..., + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + content_type: str = 'multipart/form-data', + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._upload_files_oapg( + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_upload_files/post/__init__.pyi b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_upload_files/post/__init__.pyi new file mode 100644 index 00000000000..2f0fc18a23b --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_upload_files/post/__init__.pyi @@ -0,0 +1,376 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from . import response_for_200 + + + +class RequestBody: + class Schemas: + + + class multipart_form_data( + schemas.DictSchema + ): + + + class MetaOapg: + + class properties: + + + class files( + schemas.ListSchema + ): + + + class MetaOapg: + items = schemas.BinarySchema + + def __new__( + cls, + arg: typing.Union[typing.Tuple[typing.Union[MetaOapg.items, bytes, io.FileIO, io.BufferedReader, ]], typing.List[typing.Union[MetaOapg.items, bytes, io.FileIO, io.BufferedReader, ]]], + _configuration: typing.Optional[schemas.Configuration] = None, + ) -> 'files': + return super().__new__( + cls, + arg, + _configuration=_configuration, + ) + + def __getitem__(self, i: int) -> MetaOapg.items: + return super().__getitem__(i) + __annotations__ = { + "files": files, + } + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["files"]) -> MetaOapg.properties.files: ... + + @typing.overload + def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... + + def __getitem__(self, name: typing.Union[typing_extensions.Literal["files", ], str]): + # dict_instance[name] accessor + return super().__getitem__(name) + + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["files"]) -> typing.Union[MetaOapg.properties.files, schemas.Unset]: ... + + @typing.overload + def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... + + def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["files", ], str]): + return super().get_item_oapg(name) + + + def __new__( + cls, + *args: typing.Union[dict, frozendict.frozendict, ], + files: typing.Union[MetaOapg.properties.files, list, tuple, schemas.Unset] = schemas.unset, + _configuration: typing.Optional[schemas.Configuration] = None, + **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], + ) -> 'multipart_form_data': + return super().__new__( + cls, + *args, + files=files, + _configuration=_configuration, + **kwargs, + ) + + parameter = api_client.RequestBody( + content={ + 'multipart/form-data': api_client.MediaType( + schema=Schemas.multipart_form_data + ), + }, + ) +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _upload_files_oapg( + self, + content_type: typing_extensions.Literal["multipart/form-data"] = ..., + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _upload_files_oapg( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _upload_files_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _upload_files_oapg( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _upload_files_oapg( + self, + content_type: str = 'multipart/form-data', + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + uploads files using multipart/form-data + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + _fields = None + _body = None + if body is not schemas.unset: + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class UploadFiles(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def upload_files( + self, + content_type: typing_extensions.Literal["multipart/form-data"] = ..., + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def upload_files( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def upload_files( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def upload_files( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def upload_files( + self, + content_type: str = 'multipart/form-data', + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._upload_files_oapg( + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + content_type: typing_extensions.Literal["multipart/form-data"] = ..., + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + content_type: str = 'multipart/form-data', + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._upload_files_oapg( + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/fake_upload_files/post/response_for_200.py b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_upload_files/post/response_for_200.py new file mode 100644 index 00000000000..55c94e2ea12 --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/fake_upload_files/post/response_for_200.py @@ -0,0 +1,43 @@ +import dataclasses +import urllib3 + +from petstore_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from petstore_api.model.api_response import ApiResponse + + +class BodySchemas: + # body schemas + application_json = ApiResponse + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/foo/get/__init__.py b/samples/openapi3/client/petstore/python/petstore_api/paths/foo/get/__init__.py new file mode 100644 index 00000000000..64ce3f3b439 --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/foo/get/__init__.py @@ -0,0 +1,219 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from .. import path +from . import response_for_default + + +_status_code_to_response = { + 'default': response_for_default.response, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _foo_get_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_default.ApiResponse, + ]: ... + + @typing.overload + def _foo_get_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _foo_get_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_default.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _foo_get_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='get'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class FooGet(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def foo_get( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_default.ApiResponse, + ]: ... + + @typing.overload + def foo_get( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def foo_get( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_default.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def foo_get( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._foo_get_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForget(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def get( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_default.ApiResponse, + ]: ... + + @typing.overload + def get( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def get( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_default.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def get( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._foo_get_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/foo/get/__init__.pyi b/samples/openapi3/client/petstore/python/petstore_api/paths/foo/get/__init__.pyi new file mode 100644 index 00000000000..0ff160bbb36 --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/foo/get/__init__.pyi @@ -0,0 +1,214 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from . import response_for_default + +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _foo_get_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_default.ApiResponse, + ]: ... + + @typing.overload + def _foo_get_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _foo_get_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_default.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _foo_get_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='get'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class FooGet(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def foo_get( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_default.ApiResponse, + ]: ... + + @typing.overload + def foo_get( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def foo_get( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_default.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def foo_get( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._foo_get_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForget(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def get( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_default.ApiResponse, + ]: ... + + @typing.overload + def get( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def get( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_default.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def get( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._foo_get_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/foo/get/response_for_default.py b/samples/openapi3/client/petstore/python/petstore_api/paths/foo/get/response_for_default.py new file mode 100644 index 00000000000..d403500ea4a --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/foo/get/response_for_default.py @@ -0,0 +1,95 @@ +import dataclasses +import urllib3 + +from petstore_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from petstore_api.model.foo import Foo + + +class BodySchemas: + # body schemas + + + class application_json( + schemas.DictSchema + ): + + + class MetaOapg: + + class properties: + + @staticmethod + def string() -> typing.Type['Foo']: + return Foo + __annotations__ = { + "string": string, + } + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["string"]) -> 'Foo': ... + + @typing.overload + def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... + + def __getitem__(self, name: typing.Union[typing_extensions.Literal["string", ], str]): + # dict_instance[name] accessor + return super().__getitem__(name) + + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["string"]) -> typing.Union['Foo', schemas.Unset]: ... + + @typing.overload + def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... + + def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["string", ], str]): + return super().get_item_oapg(name) + + + def __new__( + cls, + *args: typing.Union[dict, frozendict.frozendict, ], + string: typing.Union['Foo', schemas.Unset] = schemas.unset, + _configuration: typing.Optional[schemas.Configuration] = None, + **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], + ) -> 'application_json': + return super().__new__( + cls, + *args, + string=string, + _configuration=_configuration, + **kwargs, + ) + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/pet/post.py b/samples/openapi3/client/petstore/python/petstore_api/paths/pet/post.py deleted file mode 100644 index eab76eab725..00000000000 --- a/samples/openapi3/client/petstore/python/petstore_api/paths/pet/post.py +++ /dev/null @@ -1,389 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from petstore_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from petstore_api import schemas # noqa: F401 - -from petstore_api.model.pet import Pet - -from . import path - -# body param -SchemaForRequestBodyApplicationJson = Pet -SchemaForRequestBodyApplicationXml = Pet - - -request_body_pet = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - 'application/xml': api_client.MediaType( - schema=SchemaForRequestBodyApplicationXml), - }, - required=True, -) -_auth = [ - 'http_signature_test', - 'petstore_auth', -] -_servers = ( - { - 'url': "https://petstore.swagger.io/v2", - 'description': "No description provided", - }, - { - 'url': "https://path-server-test.petstore.local/v2", - 'description': "No description provided", - }, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -@dataclass -class ApiResponseFor405(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_405 = api_client.OpenApiResponse( - response_cls=ApiResponseFor405, -) -_status_code_to_response = { - '200': _response_for_200, - '405': _response_for_405, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _add_pet_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - host_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _add_pet_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationXml,], - content_type: typing_extensions.Literal["application/xml"], - host_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _add_pet_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,SchemaForRequestBodyApplicationXml,], - content_type: str = ..., - host_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _add_pet_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,SchemaForRequestBodyApplicationXml,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - host_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _add_pet_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,SchemaForRequestBodyApplicationXml,], - content_type: str = ..., - host_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _add_pet_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,SchemaForRequestBodyApplicationXml,], - content_type: str = 'application/json', - host_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - Add a new pet to the store - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_pet.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - host = self._get_host_oapg('add_pet', _servers, host_index) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - auth_settings=_auth, - host=host, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class AddPet(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def add_pet( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - host_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def add_pet( - self, - body: typing.Union[SchemaForRequestBodyApplicationXml,], - content_type: typing_extensions.Literal["application/xml"], - host_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def add_pet( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,SchemaForRequestBodyApplicationXml,], - content_type: str = ..., - host_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def add_pet( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,SchemaForRequestBodyApplicationXml,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - host_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def add_pet( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,SchemaForRequestBodyApplicationXml,], - content_type: str = ..., - host_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def add_pet( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,SchemaForRequestBodyApplicationXml,], - content_type: str = 'application/json', - host_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._add_pet_oapg( - body=body, - content_type=content_type, - host_index=host_index, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - host_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationXml,], - content_type: typing_extensions.Literal["application/xml"], - host_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,SchemaForRequestBodyApplicationXml,], - content_type: str = ..., - host_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,SchemaForRequestBodyApplicationXml,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - host_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,SchemaForRequestBodyApplicationXml,], - content_type: str = ..., - host_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,SchemaForRequestBodyApplicationXml,], - content_type: str = 'application/json', - host_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._add_pet_oapg( - body=body, - content_type=content_type, - host_index=host_index, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/pet/post.pyi b/samples/openapi3/client/petstore/python/petstore_api/paths/pet/post.pyi deleted file mode 100644 index 844a49f7094..00000000000 --- a/samples/openapi3/client/petstore/python/petstore_api/paths/pet/post.pyi +++ /dev/null @@ -1,369 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from petstore_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from petstore_api import schemas # noqa: F401 - -from petstore_api.model.pet import Pet - -# body param -SchemaForRequestBodyApplicationJson = Pet -SchemaForRequestBodyApplicationXml = Pet - - -request_body_pet = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - 'application/xml': api_client.MediaType( - schema=SchemaForRequestBodyApplicationXml), - }, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -@dataclass -class ApiResponseFor405(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_405 = api_client.OpenApiResponse( - response_cls=ApiResponseFor405, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _add_pet_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - host_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _add_pet_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationXml,], - content_type: typing_extensions.Literal["application/xml"], - host_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _add_pet_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,SchemaForRequestBodyApplicationXml,], - content_type: str = ..., - host_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _add_pet_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,SchemaForRequestBodyApplicationXml,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - host_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _add_pet_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,SchemaForRequestBodyApplicationXml,], - content_type: str = ..., - host_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _add_pet_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,SchemaForRequestBodyApplicationXml,], - content_type: str = 'application/json', - host_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - Add a new pet to the store - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_pet.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - host = self._get_host_oapg('add_pet', _servers, host_index) - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - auth_settings=_auth, - host=host, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class AddPet(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def add_pet( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - host_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def add_pet( - self, - body: typing.Union[SchemaForRequestBodyApplicationXml,], - content_type: typing_extensions.Literal["application/xml"], - host_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def add_pet( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,SchemaForRequestBodyApplicationXml,], - content_type: str = ..., - host_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def add_pet( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,SchemaForRequestBodyApplicationXml,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - host_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def add_pet( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,SchemaForRequestBodyApplicationXml,], - content_type: str = ..., - host_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def add_pet( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,SchemaForRequestBodyApplicationXml,], - content_type: str = 'application/json', - host_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._add_pet_oapg( - body=body, - content_type=content_type, - host_index=host_index, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - host_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationXml,], - content_type: typing_extensions.Literal["application/xml"], - host_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,SchemaForRequestBodyApplicationXml,], - content_type: str = ..., - host_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,SchemaForRequestBodyApplicationXml,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - host_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,SchemaForRequestBodyApplicationXml,], - content_type: str = ..., - host_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,SchemaForRequestBodyApplicationXml,], - content_type: str = 'application/json', - host_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._add_pet_oapg( - body=body, - content_type=content_type, - host_index=host_index, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/pet/post/__init__.py b/samples/openapi3/client/petstore/python/petstore_api/paths/pet/post/__init__.py new file mode 100644 index 00000000000..d1ac56e3a4d --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/pet/post/__init__.py @@ -0,0 +1,374 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from petstore_api.model.pet import Pet + +from .. import path +from . import response_for_200 +from . import response_for_405 + + + +class RequestBody: + class Schemas: + application_json = Pet + application_xml = Pet + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + 'application/xml': api_client.MediaType( + schema=Schemas.application_xml + ), + }, + required=True, + ) + +_auth = [ + 'http_signature_test', + 'petstore_auth', +] + +_servers = ( + { + 'url': "https://petstore.swagger.io/v2", + 'description': "No description provided", + }, + { + 'url': "https://path-server-test.petstore.local/v2", + 'description': "No description provided", + }, +) + +_status_code_to_response = { + '200': response_for_200.response, + '405': response_for_405.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _add_pet_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + host_index: typing.Optional[int] = None, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _add_pet_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_xml,], + content_type: typing_extensions.Literal["application/xml"], + host_index: typing.Optional[int] = None, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _add_pet_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,RequestBody.Schemas.application_xml,], + content_type: str = ..., + host_index: typing.Optional[int] = None, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _add_pet_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,RequestBody.Schemas.application_xml,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + host_index: typing.Optional[int] = None, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _add_pet_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,RequestBody.Schemas.application_xml,], + content_type: str = ..., + host_index: typing.Optional[int] = None, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _add_pet_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,RequestBody.Schemas.application_xml,], + content_type: str = 'application/json', + host_index: typing.Optional[int] = None, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + Add a new pet to the store + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + host = self._get_host_oapg('add_pet', _servers, host_index) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + auth_settings=_auth, + host=host, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class AddPet(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def add_pet( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + host_index: typing.Optional[int] = None, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def add_pet( + self, + body: typing.Union[RequestBody.Schemas.application_xml,], + content_type: typing_extensions.Literal["application/xml"], + host_index: typing.Optional[int] = None, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def add_pet( + self, + body: typing.Union[RequestBody.Schemas.application_json,RequestBody.Schemas.application_xml,], + content_type: str = ..., + host_index: typing.Optional[int] = None, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def add_pet( + self, + body: typing.Union[RequestBody.Schemas.application_json,RequestBody.Schemas.application_xml,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + host_index: typing.Optional[int] = None, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def add_pet( + self, + body: typing.Union[RequestBody.Schemas.application_json,RequestBody.Schemas.application_xml,], + content_type: str = ..., + host_index: typing.Optional[int] = None, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def add_pet( + self, + body: typing.Union[RequestBody.Schemas.application_json,RequestBody.Schemas.application_xml,], + content_type: str = 'application/json', + host_index: typing.Optional[int] = None, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._add_pet_oapg( + body=body, + content_type=content_type, + host_index=host_index, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + host_index: typing.Optional[int] = None, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_xml,], + content_type: typing_extensions.Literal["application/xml"], + host_index: typing.Optional[int] = None, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,RequestBody.Schemas.application_xml,], + content_type: str = ..., + host_index: typing.Optional[int] = None, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,RequestBody.Schemas.application_xml,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + host_index: typing.Optional[int] = None, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,RequestBody.Schemas.application_xml,], + content_type: str = ..., + host_index: typing.Optional[int] = None, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,RequestBody.Schemas.application_xml,], + content_type: str = 'application/json', + host_index: typing.Optional[int] = None, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._add_pet_oapg( + body=body, + content_type=content_type, + host_index=host_index, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/pet/post/__init__.pyi b/samples/openapi3/client/petstore/python/petstore_api/paths/pet/post/__init__.pyi new file mode 100644 index 00000000000..8d855b69484 --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/pet/post/__init__.pyi @@ -0,0 +1,352 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from petstore_api.model.pet import Pet + +from . import response_for_200 +from . import response_for_405 + + + +class RequestBody: + class Schemas: + application_json = Pet + application_xml = Pet + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + 'application/xml': api_client.MediaType( + schema=Schemas.application_xml + ), + }, + required=True, + ) + + +class BaseApi(api_client.Api): + @typing.overload + def _add_pet_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + host_index: typing.Optional[int] = None, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _add_pet_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_xml,], + content_type: typing_extensions.Literal["application/xml"], + host_index: typing.Optional[int] = None, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _add_pet_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,RequestBody.Schemas.application_xml,], + content_type: str = ..., + host_index: typing.Optional[int] = None, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _add_pet_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,RequestBody.Schemas.application_xml,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + host_index: typing.Optional[int] = None, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _add_pet_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,RequestBody.Schemas.application_xml,], + content_type: str = ..., + host_index: typing.Optional[int] = None, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _add_pet_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,RequestBody.Schemas.application_xml,], + content_type: str = 'application/json', + host_index: typing.Optional[int] = None, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + Add a new pet to the store + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + host = self._get_host_oapg('add_pet', _servers, host_index) + + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + auth_settings=_auth, + host=host, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class AddPet(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def add_pet( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + host_index: typing.Optional[int] = None, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def add_pet( + self, + body: typing.Union[RequestBody.Schemas.application_xml,], + content_type: typing_extensions.Literal["application/xml"], + host_index: typing.Optional[int] = None, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def add_pet( + self, + body: typing.Union[RequestBody.Schemas.application_json,RequestBody.Schemas.application_xml,], + content_type: str = ..., + host_index: typing.Optional[int] = None, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def add_pet( + self, + body: typing.Union[RequestBody.Schemas.application_json,RequestBody.Schemas.application_xml,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + host_index: typing.Optional[int] = None, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def add_pet( + self, + body: typing.Union[RequestBody.Schemas.application_json,RequestBody.Schemas.application_xml,], + content_type: str = ..., + host_index: typing.Optional[int] = None, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def add_pet( + self, + body: typing.Union[RequestBody.Schemas.application_json,RequestBody.Schemas.application_xml,], + content_type: str = 'application/json', + host_index: typing.Optional[int] = None, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._add_pet_oapg( + body=body, + content_type=content_type, + host_index=host_index, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + host_index: typing.Optional[int] = None, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_xml,], + content_type: typing_extensions.Literal["application/xml"], + host_index: typing.Optional[int] = None, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,RequestBody.Schemas.application_xml,], + content_type: str = ..., + host_index: typing.Optional[int] = None, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,RequestBody.Schemas.application_xml,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + host_index: typing.Optional[int] = None, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,RequestBody.Schemas.application_xml,], + content_type: str = ..., + host_index: typing.Optional[int] = None, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,RequestBody.Schemas.application_xml,], + content_type: str = 'application/json', + host_index: typing.Optional[int] = None, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._add_pet_oapg( + body=body, + content_type=content_type, + host_index=host_index, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/pet/post/response_for_200.py b/samples/openapi3/client/petstore/python/petstore_api/paths/pet/post/response_for_200.py new file mode 100644 index 00000000000..7ec95a8627a --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/pet/post/response_for_200.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from petstore_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/pet/post/response_for_405.py b/samples/openapi3/client/petstore/python/petstore_api/paths/pet/post/response_for_405.py new file mode 100644 index 00000000000..7ec95a8627a --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/pet/post/response_for_405.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from petstore_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/pet/put.py b/samples/openapi3/client/petstore/python/petstore_api/paths/pet/put.py deleted file mode 100644 index 455320b56c9..00000000000 --- a/samples/openapi3/client/petstore/python/petstore_api/paths/pet/put.py +++ /dev/null @@ -1,372 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from petstore_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from petstore_api import schemas # noqa: F401 - -from petstore_api.model.pet import Pet - -from . import path - -# body param -SchemaForRequestBodyApplicationJson = Pet -SchemaForRequestBodyApplicationXml = Pet - - -request_body_pet = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - 'application/xml': api_client.MediaType( - schema=SchemaForRequestBodyApplicationXml), - }, - required=True, -) -_auth = [ - 'http_signature_test', - 'petstore_auth', -] -_servers = ( - { - 'url': "https://petstore.swagger.io/v2", - 'description': "No description provided", - }, - { - 'url': "https://path-server-test.petstore.local/v2", - 'description': "No description provided", - }, -) - - -@dataclass -class ApiResponseFor400(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_400 = api_client.OpenApiResponse( - response_cls=ApiResponseFor400, -) - - -@dataclass -class ApiResponseFor404(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_404 = api_client.OpenApiResponse( - response_cls=ApiResponseFor404, -) - - -@dataclass -class ApiResponseFor405(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_405 = api_client.OpenApiResponse( - response_cls=ApiResponseFor405, -) -_status_code_to_response = { - '400': _response_for_400, - '404': _response_for_404, - '405': _response_for_405, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _update_pet_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - host_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def _update_pet_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationXml,], - content_type: typing_extensions.Literal["application/xml"], - host_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def _update_pet_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,SchemaForRequestBodyApplicationXml,], - content_type: str = ..., - host_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _update_pet_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,SchemaForRequestBodyApplicationXml,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - host_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _update_pet_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,SchemaForRequestBodyApplicationXml,], - content_type: str = ..., - host_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _update_pet_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,SchemaForRequestBodyApplicationXml,], - content_type: str = 'application/json', - host_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - Update an existing pet - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_pet.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - host = self._get_host_oapg('update_pet', _servers, host_index) - - response = self.api_client.call_api( - resource_path=used_path, - method='put'.upper(), - headers=_headers, - fields=_fields, - body=_body, - auth_settings=_auth, - host=host, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class UpdatePet(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def update_pet( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - host_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def update_pet( - self, - body: typing.Union[SchemaForRequestBodyApplicationXml,], - content_type: typing_extensions.Literal["application/xml"], - host_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def update_pet( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,SchemaForRequestBodyApplicationXml,], - content_type: str = ..., - host_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def update_pet( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,SchemaForRequestBodyApplicationXml,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - host_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def update_pet( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,SchemaForRequestBodyApplicationXml,], - content_type: str = ..., - host_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def update_pet( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,SchemaForRequestBodyApplicationXml,], - content_type: str = 'application/json', - host_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._update_pet_oapg( - body=body, - content_type=content_type, - host_index=host_index, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForput(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - host_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationXml,], - content_type: typing_extensions.Literal["application/xml"], - host_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,SchemaForRequestBodyApplicationXml,], - content_type: str = ..., - host_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,SchemaForRequestBodyApplicationXml,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - host_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,SchemaForRequestBodyApplicationXml,], - content_type: str = ..., - host_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,SchemaForRequestBodyApplicationXml,], - content_type: str = 'application/json', - host_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._update_pet_oapg( - body=body, - content_type=content_type, - host_index=host_index, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/pet/put.pyi b/samples/openapi3/client/petstore/python/petstore_api/paths/pet/put.pyi deleted file mode 100644 index 925cf095100..00000000000 --- a/samples/openapi3/client/petstore/python/petstore_api/paths/pet/put.pyi +++ /dev/null @@ -1,351 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from petstore_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from petstore_api import schemas # noqa: F401 - -from petstore_api.model.pet import Pet - -# body param -SchemaForRequestBodyApplicationJson = Pet -SchemaForRequestBodyApplicationXml = Pet - - -request_body_pet = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - 'application/xml': api_client.MediaType( - schema=SchemaForRequestBodyApplicationXml), - }, - required=True, -) - - -@dataclass -class ApiResponseFor400(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_400 = api_client.OpenApiResponse( - response_cls=ApiResponseFor400, -) - - -@dataclass -class ApiResponseFor404(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_404 = api_client.OpenApiResponse( - response_cls=ApiResponseFor404, -) - - -@dataclass -class ApiResponseFor405(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_405 = api_client.OpenApiResponse( - response_cls=ApiResponseFor405, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _update_pet_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - host_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def _update_pet_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationXml,], - content_type: typing_extensions.Literal["application/xml"], - host_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def _update_pet_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,SchemaForRequestBodyApplicationXml,], - content_type: str = ..., - host_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _update_pet_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,SchemaForRequestBodyApplicationXml,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - host_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _update_pet_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,SchemaForRequestBodyApplicationXml,], - content_type: str = ..., - host_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _update_pet_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,SchemaForRequestBodyApplicationXml,], - content_type: str = 'application/json', - host_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - Update an existing pet - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_pet.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - host = self._get_host_oapg('update_pet', _servers, host_index) - - response = self.api_client.call_api( - resource_path=used_path, - method='put'.upper(), - headers=_headers, - fields=_fields, - body=_body, - auth_settings=_auth, - host=host, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class UpdatePet(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def update_pet( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - host_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def update_pet( - self, - body: typing.Union[SchemaForRequestBodyApplicationXml,], - content_type: typing_extensions.Literal["application/xml"], - host_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def update_pet( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,SchemaForRequestBodyApplicationXml,], - content_type: str = ..., - host_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def update_pet( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,SchemaForRequestBodyApplicationXml,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - host_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def update_pet( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,SchemaForRequestBodyApplicationXml,], - content_type: str = ..., - host_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def update_pet( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,SchemaForRequestBodyApplicationXml,], - content_type: str = 'application/json', - host_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._update_pet_oapg( - body=body, - content_type=content_type, - host_index=host_index, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForput(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - host_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationXml,], - content_type: typing_extensions.Literal["application/xml"], - host_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,SchemaForRequestBodyApplicationXml,], - content_type: str = ..., - host_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,SchemaForRequestBodyApplicationXml,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - host_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,SchemaForRequestBodyApplicationXml,], - content_type: str = ..., - host_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,SchemaForRequestBodyApplicationXml,], - content_type: str = 'application/json', - host_index: typing.Optional[int] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._update_pet_oapg( - body=body, - content_type=content_type, - host_index=host_index, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/pet/put/__init__.py b/samples/openapi3/client/petstore/python/petstore_api/paths/pet/put/__init__.py new file mode 100644 index 00000000000..d1bd29e254b --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/pet/put/__init__.py @@ -0,0 +1,346 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from petstore_api.model.pet import Pet + +from .. import path +from . import response_for_400 +from . import response_for_404 +from . import response_for_405 + + + +class RequestBody: + class Schemas: + application_json = Pet + application_xml = Pet + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + 'application/xml': api_client.MediaType( + schema=Schemas.application_xml + ), + }, + required=True, + ) + +_auth = [ + 'http_signature_test', + 'petstore_auth', +] + +_servers = ( + { + 'url': "https://petstore.swagger.io/v2", + 'description': "No description provided", + }, + { + 'url': "https://path-server-test.petstore.local/v2", + 'description': "No description provided", + }, +) + +_status_code_to_response = { + '400': response_for_400.response, + '404': response_for_404.response, + '405': response_for_405.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _update_pet_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + host_index: typing.Optional[int] = None, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> api_client.ApiResponseWithoutDeserialization: ... + @typing.overload + def _update_pet_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_xml,], + content_type: typing_extensions.Literal["application/xml"], + host_index: typing.Optional[int] = None, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> api_client.ApiResponseWithoutDeserialization: ... + @typing.overload + def _update_pet_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,RequestBody.Schemas.application_xml,], + content_type: str = ..., + host_index: typing.Optional[int] = None, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _update_pet_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,RequestBody.Schemas.application_xml,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + host_index: typing.Optional[int] = None, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _update_pet_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,RequestBody.Schemas.application_xml,], + content_type: str = ..., + host_index: typing.Optional[int] = None, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _update_pet_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,RequestBody.Schemas.application_xml,], + content_type: str = 'application/json', + host_index: typing.Optional[int] = None, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + Update an existing pet + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + host = self._get_host_oapg('update_pet', _servers, host_index) + + response = self.api_client.call_api( + resource_path=used_path, + method='put'.upper(), + headers=_headers, + fields=_fields, + body=_body, + auth_settings=_auth, + host=host, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class UpdatePet(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def update_pet( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + host_index: typing.Optional[int] = None, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> api_client.ApiResponseWithoutDeserialization: ... + @typing.overload + def update_pet( + self, + body: typing.Union[RequestBody.Schemas.application_xml,], + content_type: typing_extensions.Literal["application/xml"], + host_index: typing.Optional[int] = None, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> api_client.ApiResponseWithoutDeserialization: ... + @typing.overload + def update_pet( + self, + body: typing.Union[RequestBody.Schemas.application_json,RequestBody.Schemas.application_xml,], + content_type: str = ..., + host_index: typing.Optional[int] = None, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def update_pet( + self, + body: typing.Union[RequestBody.Schemas.application_json,RequestBody.Schemas.application_xml,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + host_index: typing.Optional[int] = None, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def update_pet( + self, + body: typing.Union[RequestBody.Schemas.application_json,RequestBody.Schemas.application_xml,], + content_type: str = ..., + host_index: typing.Optional[int] = None, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def update_pet( + self, + body: typing.Union[RequestBody.Schemas.application_json,RequestBody.Schemas.application_xml,], + content_type: str = 'application/json', + host_index: typing.Optional[int] = None, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._update_pet_oapg( + body=body, + content_type=content_type, + host_index=host_index, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForput(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def put( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + host_index: typing.Optional[int] = None, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> api_client.ApiResponseWithoutDeserialization: ... + @typing.overload + def put( + self, + body: typing.Union[RequestBody.Schemas.application_xml,], + content_type: typing_extensions.Literal["application/xml"], + host_index: typing.Optional[int] = None, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> api_client.ApiResponseWithoutDeserialization: ... + @typing.overload + def put( + self, + body: typing.Union[RequestBody.Schemas.application_json,RequestBody.Schemas.application_xml,], + content_type: str = ..., + host_index: typing.Optional[int] = None, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def put( + self, + body: typing.Union[RequestBody.Schemas.application_json,RequestBody.Schemas.application_xml,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + host_index: typing.Optional[int] = None, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def put( + self, + body: typing.Union[RequestBody.Schemas.application_json,RequestBody.Schemas.application_xml,], + content_type: str = ..., + host_index: typing.Optional[int] = None, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def put( + self, + body: typing.Union[RequestBody.Schemas.application_json,RequestBody.Schemas.application_xml,], + content_type: str = 'application/json', + host_index: typing.Optional[int] = None, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._update_pet_oapg( + body=body, + content_type=content_type, + host_index=host_index, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/pet/put/__init__.pyi b/samples/openapi3/client/petstore/python/petstore_api/paths/pet/put/__init__.pyi new file mode 100644 index 00000000000..9ec97b5077c --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/pet/put/__init__.pyi @@ -0,0 +1,323 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from petstore_api.model.pet import Pet + +from . import response_for_400 +from . import response_for_404 +from . import response_for_405 + + + +class RequestBody: + class Schemas: + application_json = Pet + application_xml = Pet + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + 'application/xml': api_client.MediaType( + schema=Schemas.application_xml + ), + }, + required=True, + ) + + +class BaseApi(api_client.Api): + @typing.overload + def _update_pet_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + host_index: typing.Optional[int] = None, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> api_client.ApiResponseWithoutDeserialization: ... + @typing.overload + def _update_pet_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_xml,], + content_type: typing_extensions.Literal["application/xml"], + host_index: typing.Optional[int] = None, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> api_client.ApiResponseWithoutDeserialization: ... + @typing.overload + def _update_pet_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,RequestBody.Schemas.application_xml,], + content_type: str = ..., + host_index: typing.Optional[int] = None, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _update_pet_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,RequestBody.Schemas.application_xml,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + host_index: typing.Optional[int] = None, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _update_pet_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,RequestBody.Schemas.application_xml,], + content_type: str = ..., + host_index: typing.Optional[int] = None, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _update_pet_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,RequestBody.Schemas.application_xml,], + content_type: str = 'application/json', + host_index: typing.Optional[int] = None, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + Update an existing pet + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + host = self._get_host_oapg('update_pet', _servers, host_index) + + response = self.api_client.call_api( + resource_path=used_path, + method='put'.upper(), + headers=_headers, + fields=_fields, + body=_body, + auth_settings=_auth, + host=host, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class UpdatePet(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def update_pet( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + host_index: typing.Optional[int] = None, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> api_client.ApiResponseWithoutDeserialization: ... + @typing.overload + def update_pet( + self, + body: typing.Union[RequestBody.Schemas.application_xml,], + content_type: typing_extensions.Literal["application/xml"], + host_index: typing.Optional[int] = None, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> api_client.ApiResponseWithoutDeserialization: ... + @typing.overload + def update_pet( + self, + body: typing.Union[RequestBody.Schemas.application_json,RequestBody.Schemas.application_xml,], + content_type: str = ..., + host_index: typing.Optional[int] = None, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def update_pet( + self, + body: typing.Union[RequestBody.Schemas.application_json,RequestBody.Schemas.application_xml,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + host_index: typing.Optional[int] = None, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def update_pet( + self, + body: typing.Union[RequestBody.Schemas.application_json,RequestBody.Schemas.application_xml,], + content_type: str = ..., + host_index: typing.Optional[int] = None, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def update_pet( + self, + body: typing.Union[RequestBody.Schemas.application_json,RequestBody.Schemas.application_xml,], + content_type: str = 'application/json', + host_index: typing.Optional[int] = None, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._update_pet_oapg( + body=body, + content_type=content_type, + host_index=host_index, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForput(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def put( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + host_index: typing.Optional[int] = None, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> api_client.ApiResponseWithoutDeserialization: ... + @typing.overload + def put( + self, + body: typing.Union[RequestBody.Schemas.application_xml,], + content_type: typing_extensions.Literal["application/xml"], + host_index: typing.Optional[int] = None, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> api_client.ApiResponseWithoutDeserialization: ... + @typing.overload + def put( + self, + body: typing.Union[RequestBody.Schemas.application_json,RequestBody.Schemas.application_xml,], + content_type: str = ..., + host_index: typing.Optional[int] = None, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def put( + self, + body: typing.Union[RequestBody.Schemas.application_json,RequestBody.Schemas.application_xml,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + host_index: typing.Optional[int] = None, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def put( + self, + body: typing.Union[RequestBody.Schemas.application_json,RequestBody.Schemas.application_xml,], + content_type: str = ..., + host_index: typing.Optional[int] = None, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def put( + self, + body: typing.Union[RequestBody.Schemas.application_json,RequestBody.Schemas.application_xml,], + content_type: str = 'application/json', + host_index: typing.Optional[int] = None, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._update_pet_oapg( + body=body, + content_type=content_type, + host_index=host_index, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/pet/put/response_for_400.py b/samples/openapi3/client/petstore/python/petstore_api/paths/pet/put/response_for_400.py new file mode 100644 index 00000000000..7ec95a8627a --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/pet/put/response_for_400.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from petstore_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/pet/put/response_for_404.py b/samples/openapi3/client/petstore/python/petstore_api/paths/pet/put/response_for_404.py new file mode 100644 index 00000000000..7ec95a8627a --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/pet/put/response_for_404.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from petstore_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/pet/put/response_for_405.py b/samples/openapi3/client/petstore/python/petstore_api/paths/pet/put/response_for_405.py new file mode 100644 index 00000000000..7ec95a8627a --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/pet/put/response_for_405.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from petstore_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/pet_find_by_status/get/__init__.py b/samples/openapi3/client/petstore/python/petstore_api/paths/pet_find_by_status/get/__init__.py new file mode 100644 index 00000000000..a847042f618 --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/pet_find_by_status/get/__init__.py @@ -0,0 +1,330 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 +from . import response_for_400 + + + +class RequestQueryParameters: + class Schemas: + + + class status( + schemas.ListSchema + ): + + + class MetaOapg: + + + class items( + schemas.EnumBase, + schemas.StrSchema + ): + + + class MetaOapg: + enum_value_to_name = { + "available": "AVAILABLE", + "pending": "PENDING", + "sold": "SOLD", + } + + @schemas.classproperty + def AVAILABLE(cls): + return cls("available") + + @schemas.classproperty + def PENDING(cls): + return cls("pending") + + @schemas.classproperty + def SOLD(cls): + return cls("sold") + + def __new__( + cls, + arg: typing.Union[typing.Tuple[typing.Union[MetaOapg.items, str, ]], typing.List[typing.Union[MetaOapg.items, str, ]]], + _configuration: typing.Optional[schemas.Configuration] = None, + ) -> 'status': + return super().__new__( + cls, + arg, + _configuration=_configuration, + ) + + def __getitem__(self, i: int) -> MetaOapg.items: + return super().__getitem__(i) + + + RequiredParams = typing_extensions.TypedDict( + 'RequiredParams', + { + 'status': typing.Union[Schemas.status, list, tuple, ], + } + ) + OptionalParams = typing_extensions.TypedDict( + 'OptionalParams', + { + }, + total=False + ) + + + class Params(RequiredParams, OptionalParams): + pass + + + parameters = [ + api_client.QueryParameter( + name="status", + style=api_client.ParameterStyle.FORM, + schema=Schemas.status, + required=True, + ), + ] +_auth = [ + 'http_signature_test', + 'petstore_auth', +] + +_status_code_to_response = { + '200': response_for_200.response, + '400': response_for_400.response, +} +_all_accept_content_types = ( + 'application/xml', + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _find_pets_by_status_oapg( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _find_pets_by_status_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _find_pets_by_status_oapg( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _find_pets_by_status_oapg( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + Finds Pets by status + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + self._verify_typed_dict_inputs_oapg(RequestQueryParameters.Params, query_params) + used_path = path.value + + prefix_separator_iterator = None + for parameter in RequestQueryParameters.parameters: + parameter_data = query_params.get(parameter.name, schemas.unset) + if parameter_data is schemas.unset: + continue + if prefix_separator_iterator is None: + prefix_separator_iterator = parameter.get_prefix_separator_iterator() + serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) + for serialized_value in serialized_data.values(): + used_path += serialized_value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='get'.upper(), + headers=_headers, + auth_settings=_auth, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class FindPetsByStatus(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def find_pets_by_status( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def find_pets_by_status( + self, + skip_deserialization: typing_extensions.Literal[True], + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def find_pets_by_status( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def find_pets_by_status( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._find_pets_by_status_oapg( + query_params=query_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForget(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def get( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def get( + self, + skip_deserialization: typing_extensions.Literal[True], + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def get( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def get( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._find_pets_by_status_oapg( + query_params=query_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/pet_find_by_status/get/__init__.pyi b/samples/openapi3/client/petstore/python/petstore_api/paths/pet_find_by_status/get/__init__.pyi new file mode 100644 index 00000000000..5e51f87a486 --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/pet_find_by_status/get/__init__.pyi @@ -0,0 +1,311 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from . import response_for_200 +from . import response_for_400 + + + +class RequestQueryParameters: + class Schemas: + + + class status( + schemas.ListSchema + ): + + + class MetaOapg: + + + class items( + schemas.EnumBase, + schemas.StrSchema + ): + + @schemas.classproperty + def AVAILABLE(cls): + return cls("available") + + @schemas.classproperty + def PENDING(cls): + return cls("pending") + + @schemas.classproperty + def SOLD(cls): + return cls("sold") + + def __new__( + cls, + arg: typing.Union[typing.Tuple[typing.Union[MetaOapg.items, str, ]], typing.List[typing.Union[MetaOapg.items, str, ]]], + _configuration: typing.Optional[schemas.Configuration] = None, + ) -> 'status': + return super().__new__( + cls, + arg, + _configuration=_configuration, + ) + + def __getitem__(self, i: int) -> MetaOapg.items: + return super().__getitem__(i) + + + RequiredParams = typing_extensions.TypedDict( + 'RequiredParams', + { + 'status': typing.Union[Schemas.status, list, tuple, ], + } + ) + OptionalParams = typing_extensions.TypedDict( + 'OptionalParams', + { + }, + total=False + ) + + + class Params(RequiredParams, OptionalParams): + pass + + + parameters = [ + api_client.QueryParameter( + name="status", + style=api_client.ParameterStyle.FORM, + schema=Schemas.status, + required=True, + ), + ]_all_accept_content_types = ( + 'application/xml', + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _find_pets_by_status_oapg( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _find_pets_by_status_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _find_pets_by_status_oapg( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _find_pets_by_status_oapg( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + Finds Pets by status + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + self._verify_typed_dict_inputs_oapg(RequestQueryParameters.Params, query_params) + used_path = path.value + + prefix_separator_iterator = None + for parameter in RequestQueryParameters.parameters: + parameter_data = query_params.get(parameter.name, schemas.unset) + if parameter_data is schemas.unset: + continue + if prefix_separator_iterator is None: + prefix_separator_iterator = parameter.get_prefix_separator_iterator() + serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) + for serialized_value in serialized_data.values(): + used_path += serialized_value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='get'.upper(), + headers=_headers, + auth_settings=_auth, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class FindPetsByStatus(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def find_pets_by_status( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def find_pets_by_status( + self, + skip_deserialization: typing_extensions.Literal[True], + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def find_pets_by_status( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def find_pets_by_status( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._find_pets_by_status_oapg( + query_params=query_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForget(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def get( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def get( + self, + skip_deserialization: typing_extensions.Literal[True], + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def get( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def get( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._find_pets_by_status_oapg( + query_params=query_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/pet_find_by_status/get/response_for_200.py b/samples/openapi3/client/petstore/python/petstore_api/paths/pet_find_by_status/get/response_for_200.py new file mode 100644 index 00000000000..149afb6194c --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/pet_find_by_status/get/response_for_200.py @@ -0,0 +1,98 @@ +import dataclasses +import urllib3 + +from petstore_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from petstore_api.model.pet import Pet + + +class BodySchemas: + # body schemas + + + class application_xml( + schemas.ListSchema + ): + + + class MetaOapg: + + @staticmethod + def items() -> typing.Type['Pet']: + return Pet + + def __new__( + cls, + arg: typing.Union[typing.Tuple['Pet'], typing.List['Pet']], + _configuration: typing.Optional[schemas.Configuration] = None, + ) -> 'application_xml': + return super().__new__( + cls, + arg, + _configuration=_configuration, + ) + + def __getitem__(self, i: int) -> 'Pet': + return super().__getitem__(i) + + + class application_json( + schemas.ListSchema + ): + + + class MetaOapg: + + @staticmethod + def items() -> typing.Type['Pet']: + return Pet + + def __new__( + cls, + arg: typing.Union[typing.Tuple['Pet'], typing.List['Pet']], + _configuration: typing.Optional[schemas.Configuration] = None, + ) -> 'application_json': + return super().__new__( + cls, + arg, + _configuration=_configuration, + ) + + def __getitem__(self, i: int) -> 'Pet': + return super().__getitem__(i) + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_xml, + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/xml': api_client.MediaType( + schema=BodySchemas.application_xml, + ), + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/pet_find_by_status/get/response_for_400.py b/samples/openapi3/client/petstore/python/petstore_api/paths/pet_find_by_status/get/response_for_400.py new file mode 100644 index 00000000000..7ec95a8627a --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/pet_find_by_status/get/response_for_400.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from petstore_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/pet_find_by_tags/get/__init__.py b/samples/openapi3/client/petstore/python/petstore_api/paths/pet_find_by_tags/get/__init__.py new file mode 100644 index 00000000000..592eb6fd455 --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/pet_find_by_tags/get/__init__.py @@ -0,0 +1,305 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 +from . import response_for_400 + + + +class RequestQueryParameters: + class Schemas: + + + class tags( + schemas.ListSchema + ): + + + class MetaOapg: + items = schemas.StrSchema + + def __new__( + cls, + arg: typing.Union[typing.Tuple[typing.Union[MetaOapg.items, str, ]], typing.List[typing.Union[MetaOapg.items, str, ]]], + _configuration: typing.Optional[schemas.Configuration] = None, + ) -> 'tags': + return super().__new__( + cls, + arg, + _configuration=_configuration, + ) + + def __getitem__(self, i: int) -> MetaOapg.items: + return super().__getitem__(i) + + + RequiredParams = typing_extensions.TypedDict( + 'RequiredParams', + { + 'tags': typing.Union[Schemas.tags, list, tuple, ], + } + ) + OptionalParams = typing_extensions.TypedDict( + 'OptionalParams', + { + }, + total=False + ) + + + class Params(RequiredParams, OptionalParams): + pass + + + parameters = [ + api_client.QueryParameter( + name="tags", + style=api_client.ParameterStyle.FORM, + schema=Schemas.tags, + required=True, + ), + ] +_auth = [ + 'http_signature_test', + 'petstore_auth', +] + +_status_code_to_response = { + '200': response_for_200.response, + '400': response_for_400.response, +} +_all_accept_content_types = ( + 'application/xml', + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _find_pets_by_tags_oapg( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _find_pets_by_tags_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _find_pets_by_tags_oapg( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _find_pets_by_tags_oapg( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + Finds Pets by tags + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + self._verify_typed_dict_inputs_oapg(RequestQueryParameters.Params, query_params) + used_path = path.value + + prefix_separator_iterator = None + for parameter in RequestQueryParameters.parameters: + parameter_data = query_params.get(parameter.name, schemas.unset) + if parameter_data is schemas.unset: + continue + if prefix_separator_iterator is None: + prefix_separator_iterator = parameter.get_prefix_separator_iterator() + serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) + for serialized_value in serialized_data.values(): + used_path += serialized_value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='get'.upper(), + headers=_headers, + auth_settings=_auth, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class FindPetsByTags(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def find_pets_by_tags( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def find_pets_by_tags( + self, + skip_deserialization: typing_extensions.Literal[True], + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def find_pets_by_tags( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def find_pets_by_tags( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._find_pets_by_tags_oapg( + query_params=query_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForget(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def get( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def get( + self, + skip_deserialization: typing_extensions.Literal[True], + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def get( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def get( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._find_pets_by_tags_oapg( + query_params=query_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/pet_find_by_tags/get/__init__.pyi b/samples/openapi3/client/petstore/python/petstore_api/paths/pet_find_by_tags/get/__init__.pyi new file mode 100644 index 00000000000..9d9fadab4ca --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/pet_find_by_tags/get/__init__.pyi @@ -0,0 +1,294 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from . import response_for_200 +from . import response_for_400 + + + +class RequestQueryParameters: + class Schemas: + + + class tags( + schemas.ListSchema + ): + + + class MetaOapg: + items = schemas.StrSchema + + def __new__( + cls, + arg: typing.Union[typing.Tuple[typing.Union[MetaOapg.items, str, ]], typing.List[typing.Union[MetaOapg.items, str, ]]], + _configuration: typing.Optional[schemas.Configuration] = None, + ) -> 'tags': + return super().__new__( + cls, + arg, + _configuration=_configuration, + ) + + def __getitem__(self, i: int) -> MetaOapg.items: + return super().__getitem__(i) + + + RequiredParams = typing_extensions.TypedDict( + 'RequiredParams', + { + 'tags': typing.Union[Schemas.tags, list, tuple, ], + } + ) + OptionalParams = typing_extensions.TypedDict( + 'OptionalParams', + { + }, + total=False + ) + + + class Params(RequiredParams, OptionalParams): + pass + + + parameters = [ + api_client.QueryParameter( + name="tags", + style=api_client.ParameterStyle.FORM, + schema=Schemas.tags, + required=True, + ), + ]_all_accept_content_types = ( + 'application/xml', + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _find_pets_by_tags_oapg( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _find_pets_by_tags_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _find_pets_by_tags_oapg( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _find_pets_by_tags_oapg( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + Finds Pets by tags + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + self._verify_typed_dict_inputs_oapg(RequestQueryParameters.Params, query_params) + used_path = path.value + + prefix_separator_iterator = None + for parameter in RequestQueryParameters.parameters: + parameter_data = query_params.get(parameter.name, schemas.unset) + if parameter_data is schemas.unset: + continue + if prefix_separator_iterator is None: + prefix_separator_iterator = parameter.get_prefix_separator_iterator() + serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) + for serialized_value in serialized_data.values(): + used_path += serialized_value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='get'.upper(), + headers=_headers, + auth_settings=_auth, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class FindPetsByTags(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def find_pets_by_tags( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def find_pets_by_tags( + self, + skip_deserialization: typing_extensions.Literal[True], + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def find_pets_by_tags( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def find_pets_by_tags( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._find_pets_by_tags_oapg( + query_params=query_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForget(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def get( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def get( + self, + skip_deserialization: typing_extensions.Literal[True], + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def get( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def get( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._find_pets_by_tags_oapg( + query_params=query_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/pet_find_by_tags/get/response_for_200.py b/samples/openapi3/client/petstore/python/petstore_api/paths/pet_find_by_tags/get/response_for_200.py new file mode 100644 index 00000000000..149afb6194c --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/pet_find_by_tags/get/response_for_200.py @@ -0,0 +1,98 @@ +import dataclasses +import urllib3 + +from petstore_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from petstore_api.model.pet import Pet + + +class BodySchemas: + # body schemas + + + class application_xml( + schemas.ListSchema + ): + + + class MetaOapg: + + @staticmethod + def items() -> typing.Type['Pet']: + return Pet + + def __new__( + cls, + arg: typing.Union[typing.Tuple['Pet'], typing.List['Pet']], + _configuration: typing.Optional[schemas.Configuration] = None, + ) -> 'application_xml': + return super().__new__( + cls, + arg, + _configuration=_configuration, + ) + + def __getitem__(self, i: int) -> 'Pet': + return super().__getitem__(i) + + + class application_json( + schemas.ListSchema + ): + + + class MetaOapg: + + @staticmethod + def items() -> typing.Type['Pet']: + return Pet + + def __new__( + cls, + arg: typing.Union[typing.Tuple['Pet'], typing.List['Pet']], + _configuration: typing.Optional[schemas.Configuration] = None, + ) -> 'application_json': + return super().__new__( + cls, + arg, + _configuration=_configuration, + ) + + def __getitem__(self, i: int) -> 'Pet': + return super().__getitem__(i) + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_xml, + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/xml': api_client.MediaType( + schema=BodySchemas.application_xml, + ), + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/pet_find_by_tags/get/response_for_400.py b/samples/openapi3/client/petstore/python/petstore_api/paths/pet_find_by_tags/get/response_for_400.py new file mode 100644 index 00000000000..7ec95a8627a --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/pet_find_by_tags/get/response_for_400.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from petstore_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/pet_pet_id/delete.py b/samples/openapi3/client/petstore/python/petstore_api/paths/pet_pet_id/delete.py deleted file mode 100644 index 3651dff1d3b..00000000000 --- a/samples/openapi3/client/petstore/python/petstore_api/paths/pet_pet_id/delete.py +++ /dev/null @@ -1,300 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from petstore_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from petstore_api import schemas # noqa: F401 - -from . import path - -# Header params -ApiKeySchema = schemas.StrSchema -RequestRequiredHeaderParams = typing_extensions.TypedDict( - 'RequestRequiredHeaderParams', - { - } -) -RequestOptionalHeaderParams = typing_extensions.TypedDict( - 'RequestOptionalHeaderParams', - { - 'api_key': typing.Union[ApiKeySchema, str, ], - }, - total=False -) - - -class RequestHeaderParams(RequestRequiredHeaderParams, RequestOptionalHeaderParams): - pass - - -request_header_api_key = api_client.HeaderParameter( - name="api_key", - style=api_client.ParameterStyle.SIMPLE, - schema=ApiKeySchema, -) -# Path params -PetIdSchema = schemas.Int64Schema -RequestRequiredPathParams = typing_extensions.TypedDict( - 'RequestRequiredPathParams', - { - 'petId': typing.Union[PetIdSchema, decimal.Decimal, int, ], - } -) -RequestOptionalPathParams = typing_extensions.TypedDict( - 'RequestOptionalPathParams', - { - }, - total=False -) - - -class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): - pass - - -request_path_pet_id = api_client.PathParameter( - name="petId", - style=api_client.ParameterStyle.SIMPLE, - schema=PetIdSchema, - required=True, -) -_auth = [ - 'petstore_auth', -] - - -@dataclass -class ApiResponseFor400(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_400 = api_client.OpenApiResponse( - response_cls=ApiResponseFor400, -) -_status_code_to_response = { - '400': _response_for_400, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _delete_pet_oapg( - self, - header_params: RequestHeaderParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def _delete_pet_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - header_params: RequestHeaderParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _delete_pet_oapg( - self, - header_params: RequestHeaderParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _delete_pet_oapg( - self, - header_params: RequestHeaderParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - Deletes a pet - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - self._verify_typed_dict_inputs_oapg(RequestHeaderParams, header_params) - self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) - used_path = path.value - - _path_params = {} - for parameter in ( - request_path_pet_id, - ): - parameter_data = path_params.get(parameter.name, schemas.unset) - if parameter_data is schemas.unset: - continue - serialized_data = parameter.serialize(parameter_data) - _path_params.update(serialized_data) - - for k, v in _path_params.items(): - used_path = used_path.replace('{%s}' % k, v) - - _headers = HTTPHeaderDict() - for parameter in ( - request_header_api_key, - ): - parameter_data = header_params.get(parameter.name, schemas.unset) - if parameter_data is schemas.unset: - continue - serialized_data = parameter.serialize(parameter_data) - _headers.extend(serialized_data) - # TODO add cookie handling - - response = self.api_client.call_api( - resource_path=used_path, - method='delete'.upper(), - headers=_headers, - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class DeletePet(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def delete_pet( - self, - header_params: RequestHeaderParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def delete_pet( - self, - skip_deserialization: typing_extensions.Literal[True], - header_params: RequestHeaderParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def delete_pet( - self, - header_params: RequestHeaderParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def delete_pet( - self, - header_params: RequestHeaderParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._delete_pet_oapg( - header_params=header_params, - path_params=path_params, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiFordelete(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def delete( - self, - header_params: RequestHeaderParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def delete( - self, - skip_deserialization: typing_extensions.Literal[True], - header_params: RequestHeaderParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def delete( - self, - header_params: RequestHeaderParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def delete( - self, - header_params: RequestHeaderParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._delete_pet_oapg( - header_params=header_params, - path_params=path_params, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/pet_pet_id/delete.pyi b/samples/openapi3/client/petstore/python/petstore_api/paths/pet_pet_id/delete.pyi deleted file mode 100644 index eb9bc416c00..00000000000 --- a/samples/openapi3/client/petstore/python/petstore_api/paths/pet_pet_id/delete.pyi +++ /dev/null @@ -1,292 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from petstore_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from petstore_api import schemas # noqa: F401 - -# Header params -ApiKeySchema = schemas.StrSchema -RequestRequiredHeaderParams = typing_extensions.TypedDict( - 'RequestRequiredHeaderParams', - { - } -) -RequestOptionalHeaderParams = typing_extensions.TypedDict( - 'RequestOptionalHeaderParams', - { - 'api_key': typing.Union[ApiKeySchema, str, ], - }, - total=False -) - - -class RequestHeaderParams(RequestRequiredHeaderParams, RequestOptionalHeaderParams): - pass - - -request_header_api_key = api_client.HeaderParameter( - name="api_key", - style=api_client.ParameterStyle.SIMPLE, - schema=ApiKeySchema, -) -# Path params -PetIdSchema = schemas.Int64Schema -RequestRequiredPathParams = typing_extensions.TypedDict( - 'RequestRequiredPathParams', - { - 'petId': typing.Union[PetIdSchema, decimal.Decimal, int, ], - } -) -RequestOptionalPathParams = typing_extensions.TypedDict( - 'RequestOptionalPathParams', - { - }, - total=False -) - - -class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): - pass - - -request_path_pet_id = api_client.PathParameter( - name="petId", - style=api_client.ParameterStyle.SIMPLE, - schema=PetIdSchema, - required=True, -) - - -@dataclass -class ApiResponseFor400(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_400 = api_client.OpenApiResponse( - response_cls=ApiResponseFor400, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _delete_pet_oapg( - self, - header_params: RequestHeaderParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def _delete_pet_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - header_params: RequestHeaderParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _delete_pet_oapg( - self, - header_params: RequestHeaderParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _delete_pet_oapg( - self, - header_params: RequestHeaderParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - Deletes a pet - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - self._verify_typed_dict_inputs_oapg(RequestHeaderParams, header_params) - self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) - used_path = path.value - - _path_params = {} - for parameter in ( - request_path_pet_id, - ): - parameter_data = path_params.get(parameter.name, schemas.unset) - if parameter_data is schemas.unset: - continue - serialized_data = parameter.serialize(parameter_data) - _path_params.update(serialized_data) - - for k, v in _path_params.items(): - used_path = used_path.replace('{%s}' % k, v) - - _headers = HTTPHeaderDict() - for parameter in ( - request_header_api_key, - ): - parameter_data = header_params.get(parameter.name, schemas.unset) - if parameter_data is schemas.unset: - continue - serialized_data = parameter.serialize(parameter_data) - _headers.extend(serialized_data) - # TODO add cookie handling - - response = self.api_client.call_api( - resource_path=used_path, - method='delete'.upper(), - headers=_headers, - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class DeletePet(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def delete_pet( - self, - header_params: RequestHeaderParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def delete_pet( - self, - skip_deserialization: typing_extensions.Literal[True], - header_params: RequestHeaderParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def delete_pet( - self, - header_params: RequestHeaderParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def delete_pet( - self, - header_params: RequestHeaderParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._delete_pet_oapg( - header_params=header_params, - path_params=path_params, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiFordelete(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def delete( - self, - header_params: RequestHeaderParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def delete( - self, - skip_deserialization: typing_extensions.Literal[True], - header_params: RequestHeaderParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def delete( - self, - header_params: RequestHeaderParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def delete( - self, - header_params: RequestHeaderParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._delete_pet_oapg( - header_params=header_params, - path_params=path_params, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/pet_pet_id/delete/__init__.py b/samples/openapi3/client/petstore/python/petstore_api/paths/pet_pet_id/delete/__init__.py new file mode 100644 index 00000000000..ae9794781ba --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/pet_pet_id/delete/__init__.py @@ -0,0 +1,299 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from .. import path +from . import response_for_400 + + + +class RequestHeaderParameters: + class Schemas: + api_key = schemas.StrSchema + + + RequiredParams = typing_extensions.TypedDict( + 'RequiredParams', + { + } + ) + OptionalParams = typing_extensions.TypedDict( + 'OptionalParams', + { + 'api_key': typing.Union[Schemas.api_key, str, ], + }, + total=False + ) + + + class Params(RequiredParams, OptionalParams): + pass + + + parameters = [ + api_client.HeaderParameter( + name="api_key", + style=api_client.ParameterStyle.SIMPLE, + schema=Schemas.api_key, + ), + ] + +class RequestPathParameters: + class Schemas: + petId = schemas.Int64Schema + + + RequiredParams = typing_extensions.TypedDict( + 'RequiredParams', + { + 'petId': typing.Union[Schemas.petId, decimal.Decimal, int, ], + } + ) + OptionalParams = typing_extensions.TypedDict( + 'OptionalParams', + { + }, + total=False + ) + + + class Params(RequiredParams, OptionalParams): + pass + + + parameters = [ + api_client.PathParameter( + name="petId", + style=api_client.ParameterStyle.SIMPLE, + schema=Schemas.petId, + required=True, + ), + ] +_auth = [ + 'petstore_auth', +] + +_status_code_to_response = { + '400': response_for_400.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _delete_pet_oapg( + self, + header_params: RequestHeaderParameters.Params = frozendict.frozendict(), + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> api_client.ApiResponseWithoutDeserialization: ... + @typing.overload + def _delete_pet_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + header_params: RequestHeaderParameters.Params = frozendict.frozendict(), + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _delete_pet_oapg( + self, + header_params: RequestHeaderParameters.Params = frozendict.frozendict(), + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _delete_pet_oapg( + self, + header_params: RequestHeaderParameters.Params = frozendict.frozendict(), + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + Deletes a pet + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + self._verify_typed_dict_inputs_oapg(RequestHeaderParameters.Params, header_params) + self._verify_typed_dict_inputs_oapg(RequestPathParameters.Params, path_params) + used_path = path.value + + _path_params = {} + for parameter in RequestPathParameters.parameters: + parameter_data = path_params.get(parameter.name, schemas.unset) + if parameter_data is schemas.unset: + continue + serialized_data = parameter.serialize(parameter_data) + _path_params.update(serialized_data) + + for k, v in _path_params.items(): + used_path = used_path.replace('{%s}' % k, v) + + _headers = HTTPHeaderDict() + for parameter in RequestHeaderParameters.parameters: + parameter_data = header_params.get(parameter.name, schemas.unset) + if parameter_data is schemas.unset: + continue + serialized_data = parameter.serialize(parameter_data) + _headers.extend(serialized_data) + # TODO add cookie handling + + response = self.api_client.call_api( + resource_path=used_path, + method='delete'.upper(), + headers=_headers, + auth_settings=_auth, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class DeletePet(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def delete_pet( + self, + header_params: RequestHeaderParameters.Params = frozendict.frozendict(), + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> api_client.ApiResponseWithoutDeserialization: ... + @typing.overload + def delete_pet( + self, + skip_deserialization: typing_extensions.Literal[True], + header_params: RequestHeaderParameters.Params = frozendict.frozendict(), + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def delete_pet( + self, + header_params: RequestHeaderParameters.Params = frozendict.frozendict(), + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def delete_pet( + self, + header_params: RequestHeaderParameters.Params = frozendict.frozendict(), + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._delete_pet_oapg( + header_params=header_params, + path_params=path_params, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiFordelete(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def delete( + self, + header_params: RequestHeaderParameters.Params = frozendict.frozendict(), + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> api_client.ApiResponseWithoutDeserialization: ... + @typing.overload + def delete( + self, + skip_deserialization: typing_extensions.Literal[True], + header_params: RequestHeaderParameters.Params = frozendict.frozendict(), + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def delete( + self, + header_params: RequestHeaderParameters.Params = frozendict.frozendict(), + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def delete( + self, + header_params: RequestHeaderParameters.Params = frozendict.frozendict(), + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._delete_pet_oapg( + header_params=header_params, + path_params=path_params, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/pet_pet_id/delete/__init__.pyi b/samples/openapi3/client/petstore/python/petstore_api/paths/pet_pet_id/delete/__init__.pyi new file mode 100644 index 00000000000..f241c02c509 --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/pet_pet_id/delete/__init__.pyi @@ -0,0 +1,290 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from . import response_for_400 + + + +class RequestHeaderParameters: + class Schemas: + api_key = schemas.StrSchema + + + RequiredParams = typing_extensions.TypedDict( + 'RequiredParams', + { + } + ) + OptionalParams = typing_extensions.TypedDict( + 'OptionalParams', + { + 'api_key': typing.Union[Schemas.api_key, str, ], + }, + total=False + ) + + + class Params(RequiredParams, OptionalParams): + pass + + + parameters = [ + api_client.HeaderParameter( + name="api_key", + style=api_client.ParameterStyle.SIMPLE, + schema=Schemas.api_key, + ), + ] + +class RequestPathParameters: + class Schemas: + petId = schemas.Int64Schema + + + RequiredParams = typing_extensions.TypedDict( + 'RequiredParams', + { + 'petId': typing.Union[Schemas.petId, decimal.Decimal, int, ], + } + ) + OptionalParams = typing_extensions.TypedDict( + 'OptionalParams', + { + }, + total=False + ) + + + class Params(RequiredParams, OptionalParams): + pass + + + parameters = [ + api_client.PathParameter( + name="petId", + style=api_client.ParameterStyle.SIMPLE, + schema=Schemas.petId, + required=True, + ), + ] + +class BaseApi(api_client.Api): + @typing.overload + def _delete_pet_oapg( + self, + header_params: RequestHeaderParameters.Params = frozendict.frozendict(), + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> api_client.ApiResponseWithoutDeserialization: ... + @typing.overload + def _delete_pet_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + header_params: RequestHeaderParameters.Params = frozendict.frozendict(), + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _delete_pet_oapg( + self, + header_params: RequestHeaderParameters.Params = frozendict.frozendict(), + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _delete_pet_oapg( + self, + header_params: RequestHeaderParameters.Params = frozendict.frozendict(), + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + Deletes a pet + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + self._verify_typed_dict_inputs_oapg(RequestHeaderParameters.Params, header_params) + self._verify_typed_dict_inputs_oapg(RequestPathParameters.Params, path_params) + used_path = path.value + + _path_params = {} + for parameter in RequestPathParameters.parameters: + parameter_data = path_params.get(parameter.name, schemas.unset) + if parameter_data is schemas.unset: + continue + serialized_data = parameter.serialize(parameter_data) + _path_params.update(serialized_data) + + for k, v in _path_params.items(): + used_path = used_path.replace('{%s}' % k, v) + + _headers = HTTPHeaderDict() + for parameter in RequestHeaderParameters.parameters: + parameter_data = header_params.get(parameter.name, schemas.unset) + if parameter_data is schemas.unset: + continue + serialized_data = parameter.serialize(parameter_data) + _headers.extend(serialized_data) + # TODO add cookie handling + + response = self.api_client.call_api( + resource_path=used_path, + method='delete'.upper(), + headers=_headers, + auth_settings=_auth, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class DeletePet(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def delete_pet( + self, + header_params: RequestHeaderParameters.Params = frozendict.frozendict(), + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> api_client.ApiResponseWithoutDeserialization: ... + @typing.overload + def delete_pet( + self, + skip_deserialization: typing_extensions.Literal[True], + header_params: RequestHeaderParameters.Params = frozendict.frozendict(), + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def delete_pet( + self, + header_params: RequestHeaderParameters.Params = frozendict.frozendict(), + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def delete_pet( + self, + header_params: RequestHeaderParameters.Params = frozendict.frozendict(), + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._delete_pet_oapg( + header_params=header_params, + path_params=path_params, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiFordelete(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def delete( + self, + header_params: RequestHeaderParameters.Params = frozendict.frozendict(), + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> api_client.ApiResponseWithoutDeserialization: ... + @typing.overload + def delete( + self, + skip_deserialization: typing_extensions.Literal[True], + header_params: RequestHeaderParameters.Params = frozendict.frozendict(), + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def delete( + self, + header_params: RequestHeaderParameters.Params = frozendict.frozendict(), + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def delete( + self, + header_params: RequestHeaderParameters.Params = frozendict.frozendict(), + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._delete_pet_oapg( + header_params=header_params, + path_params=path_params, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/pet_pet_id/delete/response_for_400.py b/samples/openapi3/client/petstore/python/petstore_api/paths/pet_pet_id/delete/response_for_400.py new file mode 100644 index 00000000000..7ec95a8627a --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/pet_pet_id/delete/response_for_400.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from petstore_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/pet_pet_id/get.py b/samples/openapi3/client/petstore/python/petstore_api/paths/pet_pet_id/get.py deleted file mode 100644 index 9dc1735114e..00000000000 --- a/samples/openapi3/client/petstore/python/petstore_api/paths/pet_pet_id/get.py +++ /dev/null @@ -1,324 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from petstore_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from petstore_api import schemas # noqa: F401 - -from petstore_api.model.pet import Pet - -from . import path - -# Path params -PetIdSchema = schemas.Int64Schema -RequestRequiredPathParams = typing_extensions.TypedDict( - 'RequestRequiredPathParams', - { - 'petId': typing.Union[PetIdSchema, decimal.Decimal, int, ], - } -) -RequestOptionalPathParams = typing_extensions.TypedDict( - 'RequestOptionalPathParams', - { - }, - total=False -) - - -class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): - pass - - -request_path_pet_id = api_client.PathParameter( - name="petId", - style=api_client.ParameterStyle.SIMPLE, - schema=PetIdSchema, - required=True, -) -_auth = [ - 'api_key', -] -SchemaFor200ResponseBodyApplicationXml = Pet -SchemaFor200ResponseBodyApplicationJson = Pet - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationXml, - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/xml': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationXml), - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) - - -@dataclass -class ApiResponseFor400(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_400 = api_client.OpenApiResponse( - response_cls=ApiResponseFor400, -) - - -@dataclass -class ApiResponseFor404(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_404 = api_client.OpenApiResponse( - response_cls=ApiResponseFor404, -) -_status_code_to_response = { - '200': _response_for_200, - '400': _response_for_400, - '404': _response_for_404, -} -_all_accept_content_types = ( - 'application/xml', - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _get_pet_by_id_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _get_pet_by_id_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _get_pet_by_id_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _get_pet_by_id_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - Find pet by ID - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) - used_path = path.value - - _path_params = {} - for parameter in ( - request_path_pet_id, - ): - parameter_data = path_params.get(parameter.name, schemas.unset) - if parameter_data is schemas.unset: - continue - serialized_data = parameter.serialize(parameter_data) - _path_params.update(serialized_data) - - for k, v in _path_params.items(): - used_path = used_path.replace('{%s}' % k, v) - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='get'.upper(), - headers=_headers, - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class GetPetById(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def get_pet_by_id( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def get_pet_by_id( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_pet_by_id( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_pet_by_id( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_pet_by_id_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForget(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def get( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def get( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_pet_by_id_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/pet_pet_id/get.pyi b/samples/openapi3/client/petstore/python/petstore_api/paths/pet_pet_id/get.pyi deleted file mode 100644 index 5ae107f3242..00000000000 --- a/samples/openapi3/client/petstore/python/petstore_api/paths/pet_pet_id/get.pyi +++ /dev/null @@ -1,314 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from petstore_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from petstore_api import schemas # noqa: F401 - -from petstore_api.model.pet import Pet - -# Path params -PetIdSchema = schemas.Int64Schema -RequestRequiredPathParams = typing_extensions.TypedDict( - 'RequestRequiredPathParams', - { - 'petId': typing.Union[PetIdSchema, decimal.Decimal, int, ], - } -) -RequestOptionalPathParams = typing_extensions.TypedDict( - 'RequestOptionalPathParams', - { - }, - total=False -) - - -class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): - pass - - -request_path_pet_id = api_client.PathParameter( - name="petId", - style=api_client.ParameterStyle.SIMPLE, - schema=PetIdSchema, - required=True, -) -SchemaFor200ResponseBodyApplicationXml = Pet -SchemaFor200ResponseBodyApplicationJson = Pet - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationXml, - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/xml': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationXml), - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) - - -@dataclass -class ApiResponseFor400(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_400 = api_client.OpenApiResponse( - response_cls=ApiResponseFor400, -) - - -@dataclass -class ApiResponseFor404(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_404 = api_client.OpenApiResponse( - response_cls=ApiResponseFor404, -) -_all_accept_content_types = ( - 'application/xml', - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _get_pet_by_id_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _get_pet_by_id_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _get_pet_by_id_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _get_pet_by_id_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - Find pet by ID - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) - used_path = path.value - - _path_params = {} - for parameter in ( - request_path_pet_id, - ): - parameter_data = path_params.get(parameter.name, schemas.unset) - if parameter_data is schemas.unset: - continue - serialized_data = parameter.serialize(parameter_data) - _path_params.update(serialized_data) - - for k, v in _path_params.items(): - used_path = used_path.replace('{%s}' % k, v) - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='get'.upper(), - headers=_headers, - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class GetPetById(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def get_pet_by_id( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def get_pet_by_id( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_pet_by_id( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_pet_by_id( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_pet_by_id_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForget(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def get( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def get( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_pet_by_id_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/pet_pet_id/get/__init__.py b/samples/openapi3/client/petstore/python/petstore_api/paths/pet_pet_id/get/__init__.py new file mode 100644 index 00000000000..df4f58cef30 --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/pet_pet_id/get/__init__.py @@ -0,0 +1,284 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 +from . import response_for_400 +from . import response_for_404 + + + +class RequestPathParameters: + class Schemas: + petId = schemas.Int64Schema + + + RequiredParams = typing_extensions.TypedDict( + 'RequiredParams', + { + 'petId': typing.Union[Schemas.petId, decimal.Decimal, int, ], + } + ) + OptionalParams = typing_extensions.TypedDict( + 'OptionalParams', + { + }, + total=False + ) + + + class Params(RequiredParams, OptionalParams): + pass + + + parameters = [ + api_client.PathParameter( + name="petId", + style=api_client.ParameterStyle.SIMPLE, + schema=Schemas.petId, + required=True, + ), + ] +_auth = [ + 'api_key', +] + +_status_code_to_response = { + '200': response_for_200.response, + '400': response_for_400.response, + '404': response_for_404.response, +} +_all_accept_content_types = ( + 'application/xml', + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _get_pet_by_id_oapg( + self, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _get_pet_by_id_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _get_pet_by_id_oapg( + self, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _get_pet_by_id_oapg( + self, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + Find pet by ID + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + self._verify_typed_dict_inputs_oapg(RequestPathParameters.Params, path_params) + used_path = path.value + + _path_params = {} + for parameter in RequestPathParameters.parameters: + parameter_data = path_params.get(parameter.name, schemas.unset) + if parameter_data is schemas.unset: + continue + serialized_data = parameter.serialize(parameter_data) + _path_params.update(serialized_data) + + for k, v in _path_params.items(): + used_path = used_path.replace('{%s}' % k, v) + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='get'.upper(), + headers=_headers, + auth_settings=_auth, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class GetPetById(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def get_pet_by_id( + self, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def get_pet_by_id( + self, + skip_deserialization: typing_extensions.Literal[True], + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def get_pet_by_id( + self, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def get_pet_by_id( + self, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._get_pet_by_id_oapg( + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForget(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def get( + self, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def get( + self, + skip_deserialization: typing_extensions.Literal[True], + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def get( + self, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def get( + self, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._get_pet_by_id_oapg( + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/pet_pet_id/get/__init__.pyi b/samples/openapi3/client/petstore/python/petstore_api/paths/pet_pet_id/get/__init__.pyi new file mode 100644 index 00000000000..6fcd25ff950 --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/pet_pet_id/get/__init__.pyi @@ -0,0 +1,273 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from . import response_for_200 +from . import response_for_400 +from . import response_for_404 + + + +class RequestPathParameters: + class Schemas: + petId = schemas.Int64Schema + + + RequiredParams = typing_extensions.TypedDict( + 'RequiredParams', + { + 'petId': typing.Union[Schemas.petId, decimal.Decimal, int, ], + } + ) + OptionalParams = typing_extensions.TypedDict( + 'OptionalParams', + { + }, + total=False + ) + + + class Params(RequiredParams, OptionalParams): + pass + + + parameters = [ + api_client.PathParameter( + name="petId", + style=api_client.ParameterStyle.SIMPLE, + schema=Schemas.petId, + required=True, + ), + ]_all_accept_content_types = ( + 'application/xml', + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _get_pet_by_id_oapg( + self, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _get_pet_by_id_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _get_pet_by_id_oapg( + self, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _get_pet_by_id_oapg( + self, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + Find pet by ID + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + self._verify_typed_dict_inputs_oapg(RequestPathParameters.Params, path_params) + used_path = path.value + + _path_params = {} + for parameter in RequestPathParameters.parameters: + parameter_data = path_params.get(parameter.name, schemas.unset) + if parameter_data is schemas.unset: + continue + serialized_data = parameter.serialize(parameter_data) + _path_params.update(serialized_data) + + for k, v in _path_params.items(): + used_path = used_path.replace('{%s}' % k, v) + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='get'.upper(), + headers=_headers, + auth_settings=_auth, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class GetPetById(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def get_pet_by_id( + self, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def get_pet_by_id( + self, + skip_deserialization: typing_extensions.Literal[True], + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def get_pet_by_id( + self, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def get_pet_by_id( + self, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._get_pet_by_id_oapg( + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForget(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def get( + self, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def get( + self, + skip_deserialization: typing_extensions.Literal[True], + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def get( + self, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def get( + self, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._get_pet_by_id_oapg( + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/pet_pet_id/get/response_for_200.py b/samples/openapi3/client/petstore/python/petstore_api/paths/pet_pet_id/get/response_for_200.py new file mode 100644 index 00000000000..632ed1944b6 --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/pet_pet_id/get/response_for_200.py @@ -0,0 +1,48 @@ +import dataclasses +import urllib3 + +from petstore_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from petstore_api.model.pet import Pet + + +class BodySchemas: + # body schemas + application_xml = Pet + application_json = Pet + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_xml, + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/xml': api_client.MediaType( + schema=BodySchemas.application_xml, + ), + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/pet_pet_id/get/response_for_400.py b/samples/openapi3/client/petstore/python/petstore_api/paths/pet_pet_id/get/response_for_400.py new file mode 100644 index 00000000000..7ec95a8627a --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/pet_pet_id/get/response_for_400.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from petstore_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/pet_pet_id/get/response_for_404.py b/samples/openapi3/client/petstore/python/petstore_api/paths/pet_pet_id/get/response_for_404.py new file mode 100644 index 00000000000..7ec95a8627a --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/pet_pet_id/get/response_for_404.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from petstore_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/pet_pet_id/post.py b/samples/openapi3/client/petstore/python/petstore_api/paths/pet_pet_id/post.py deleted file mode 100644 index 101ac83216f..00000000000 --- a/samples/openapi3/client/petstore/python/petstore_api/paths/pet_pet_id/post.py +++ /dev/null @@ -1,393 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from petstore_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from petstore_api import schemas # noqa: F401 - -from . import path - -# Path params -PetIdSchema = schemas.Int64Schema -RequestRequiredPathParams = typing_extensions.TypedDict( - 'RequestRequiredPathParams', - { - 'petId': typing.Union[PetIdSchema, decimal.Decimal, int, ], - } -) -RequestOptionalPathParams = typing_extensions.TypedDict( - 'RequestOptionalPathParams', - { - }, - total=False -) - - -class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): - pass - - -request_path_pet_id = api_client.PathParameter( - name="petId", - style=api_client.ParameterStyle.SIMPLE, - schema=PetIdSchema, - required=True, -) -# body param - - -class SchemaForRequestBodyApplicationXWwwFormUrlencoded( - schemas.DictSchema -): - - - class MetaOapg: - - class properties: - name = schemas.StrSchema - status = schemas.StrSchema - __annotations__ = { - "name": name, - "status": status, - } - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["name"]) -> MetaOapg.properties.name: ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["status"]) -> MetaOapg.properties.status: ... - - @typing.overload - def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... - - def __getitem__(self, name: typing.Union[typing_extensions.Literal["name", "status", ], str]): - # dict_instance[name] accessor - return super().__getitem__(name) - - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["name"]) -> typing.Union[MetaOapg.properties.name, schemas.Unset]: ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["status"]) -> typing.Union[MetaOapg.properties.status, schemas.Unset]: ... - - @typing.overload - def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... - - def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["name", "status", ], str]): - return super().get_item_oapg(name) - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, ], - name: typing.Union[MetaOapg.properties.name, str, schemas.Unset] = schemas.unset, - status: typing.Union[MetaOapg.properties.status, str, schemas.Unset] = schemas.unset, - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'SchemaForRequestBodyApplicationXWwwFormUrlencoded': - return super().__new__( - cls, - *args, - name=name, - status=status, - _configuration=_configuration, - **kwargs, - ) - - -request_body_body = api_client.RequestBody( - content={ - 'application/x-www-form-urlencoded': api_client.MediaType( - schema=SchemaForRequestBodyApplicationXWwwFormUrlencoded), - }, -) -_auth = [ - 'petstore_auth', -] - - -@dataclass -class ApiResponseFor405(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_405 = api_client.OpenApiResponse( - response_cls=ApiResponseFor405, -) -_status_code_to_response = { - '405': _response_for_405, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _update_pet_with_form_oapg( - self, - content_type: typing_extensions.Literal["application/x-www-form-urlencoded"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def _update_pet_with_form_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _update_pet_with_form_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _update_pet_with_form_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _update_pet_with_form_oapg( - self, - content_type: str = 'application/x-www-form-urlencoded', - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - Updates a pet in the store with form data - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) - used_path = path.value - - _path_params = {} - for parameter in ( - request_path_pet_id, - ): - parameter_data = path_params.get(parameter.name, schemas.unset) - if parameter_data is schemas.unset: - continue - serialized_data = parameter.serialize(parameter_data) - _path_params.update(serialized_data) - - for k, v in _path_params.items(): - used_path = used_path.replace('{%s}' % k, v) - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - _fields = None - _body = None - if body is not schemas.unset: - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class UpdatePetWithForm(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def update_pet_with_form( - self, - content_type: typing_extensions.Literal["application/x-www-form-urlencoded"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def update_pet_with_form( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def update_pet_with_form( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def update_pet_with_form( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def update_pet_with_form( - self, - content_type: str = 'application/x-www-form-urlencoded', - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._update_pet_with_form_oapg( - body=body, - path_params=path_params, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - content_type: typing_extensions.Literal["application/x-www-form-urlencoded"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def post( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - content_type: str = 'application/x-www-form-urlencoded', - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._update_pet_with_form_oapg( - body=body, - path_params=path_params, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/pet_pet_id/post.pyi b/samples/openapi3/client/petstore/python/petstore_api/paths/pet_pet_id/post.pyi deleted file mode 100644 index f2be056a388..00000000000 --- a/samples/openapi3/client/petstore/python/petstore_api/paths/pet_pet_id/post.pyi +++ /dev/null @@ -1,385 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from petstore_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from petstore_api import schemas # noqa: F401 - -# Path params -PetIdSchema = schemas.Int64Schema -RequestRequiredPathParams = typing_extensions.TypedDict( - 'RequestRequiredPathParams', - { - 'petId': typing.Union[PetIdSchema, decimal.Decimal, int, ], - } -) -RequestOptionalPathParams = typing_extensions.TypedDict( - 'RequestOptionalPathParams', - { - }, - total=False -) - - -class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): - pass - - -request_path_pet_id = api_client.PathParameter( - name="petId", - style=api_client.ParameterStyle.SIMPLE, - schema=PetIdSchema, - required=True, -) -# body param - - -class SchemaForRequestBodyApplicationXWwwFormUrlencoded( - schemas.DictSchema -): - - - class MetaOapg: - - class properties: - name = schemas.StrSchema - status = schemas.StrSchema - __annotations__ = { - "name": name, - "status": status, - } - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["name"]) -> MetaOapg.properties.name: ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["status"]) -> MetaOapg.properties.status: ... - - @typing.overload - def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... - - def __getitem__(self, name: typing.Union[typing_extensions.Literal["name", "status", ], str]): - # dict_instance[name] accessor - return super().__getitem__(name) - - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["name"]) -> typing.Union[MetaOapg.properties.name, schemas.Unset]: ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["status"]) -> typing.Union[MetaOapg.properties.status, schemas.Unset]: ... - - @typing.overload - def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... - - def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["name", "status", ], str]): - return super().get_item_oapg(name) - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, ], - name: typing.Union[MetaOapg.properties.name, str, schemas.Unset] = schemas.unset, - status: typing.Union[MetaOapg.properties.status, str, schemas.Unset] = schemas.unset, - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'SchemaForRequestBodyApplicationXWwwFormUrlencoded': - return super().__new__( - cls, - *args, - name=name, - status=status, - _configuration=_configuration, - **kwargs, - ) - - -request_body_body = api_client.RequestBody( - content={ - 'application/x-www-form-urlencoded': api_client.MediaType( - schema=SchemaForRequestBodyApplicationXWwwFormUrlencoded), - }, -) - - -@dataclass -class ApiResponseFor405(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_405 = api_client.OpenApiResponse( - response_cls=ApiResponseFor405, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _update_pet_with_form_oapg( - self, - content_type: typing_extensions.Literal["application/x-www-form-urlencoded"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def _update_pet_with_form_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _update_pet_with_form_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _update_pet_with_form_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _update_pet_with_form_oapg( - self, - content_type: str = 'application/x-www-form-urlencoded', - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - Updates a pet in the store with form data - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) - used_path = path.value - - _path_params = {} - for parameter in ( - request_path_pet_id, - ): - parameter_data = path_params.get(parameter.name, schemas.unset) - if parameter_data is schemas.unset: - continue - serialized_data = parameter.serialize(parameter_data) - _path_params.update(serialized_data) - - for k, v in _path_params.items(): - used_path = used_path.replace('{%s}' % k, v) - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - _fields = None - _body = None - if body is not schemas.unset: - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class UpdatePetWithForm(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def update_pet_with_form( - self, - content_type: typing_extensions.Literal["application/x-www-form-urlencoded"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def update_pet_with_form( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def update_pet_with_form( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def update_pet_with_form( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def update_pet_with_form( - self, - content_type: str = 'application/x-www-form-urlencoded', - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._update_pet_with_form_oapg( - body=body, - path_params=path_params, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - content_type: typing_extensions.Literal["application/x-www-form-urlencoded"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def post( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - content_type: str = 'application/x-www-form-urlencoded', - body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._update_pet_with_form_oapg( - body=body, - path_params=path_params, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/pet_pet_id/post/__init__.py b/samples/openapi3/client/petstore/python/petstore_api/paths/pet_pet_id/post/__init__.py new file mode 100644 index 00000000000..d71f45b596c --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/pet_pet_id/post/__init__.py @@ -0,0 +1,391 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from .. import path +from . import response_for_405 + + + +class RequestPathParameters: + class Schemas: + petId = schemas.Int64Schema + + + RequiredParams = typing_extensions.TypedDict( + 'RequiredParams', + { + 'petId': typing.Union[Schemas.petId, decimal.Decimal, int, ], + } + ) + OptionalParams = typing_extensions.TypedDict( + 'OptionalParams', + { + }, + total=False + ) + + + class Params(RequiredParams, OptionalParams): + pass + + + parameters = [ + api_client.PathParameter( + name="petId", + style=api_client.ParameterStyle.SIMPLE, + schema=Schemas.petId, + required=True, + ), + ] + +class RequestBody: + class Schemas: + + + class application_x_www_form_urlencoded( + schemas.DictSchema + ): + + + class MetaOapg: + + class properties: + name = schemas.StrSchema + status = schemas.StrSchema + __annotations__ = { + "name": name, + "status": status, + } + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["name"]) -> MetaOapg.properties.name: ... + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["status"]) -> MetaOapg.properties.status: ... + + @typing.overload + def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... + + def __getitem__(self, name: typing.Union[typing_extensions.Literal["name", "status", ], str]): + # dict_instance[name] accessor + return super().__getitem__(name) + + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["name"]) -> typing.Union[MetaOapg.properties.name, schemas.Unset]: ... + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["status"]) -> typing.Union[MetaOapg.properties.status, schemas.Unset]: ... + + @typing.overload + def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... + + def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["name", "status", ], str]): + return super().get_item_oapg(name) + + + def __new__( + cls, + *args: typing.Union[dict, frozendict.frozendict, ], + name: typing.Union[MetaOapg.properties.name, str, schemas.Unset] = schemas.unset, + status: typing.Union[MetaOapg.properties.status, str, schemas.Unset] = schemas.unset, + _configuration: typing.Optional[schemas.Configuration] = None, + **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], + ) -> 'application_x_www_form_urlencoded': + return super().__new__( + cls, + *args, + name=name, + status=status, + _configuration=_configuration, + **kwargs, + ) + + parameter = api_client.RequestBody( + content={ + 'application/x-www-form-urlencoded': api_client.MediaType( + schema=Schemas.application_x_www_form_urlencoded + ), + }, + ) + +_auth = [ + 'petstore_auth', +] + +_status_code_to_response = { + '405': response_for_405.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _update_pet_with_form_oapg( + self, + content_type: typing_extensions.Literal["application/x-www-form-urlencoded"] = ..., + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> api_client.ApiResponseWithoutDeserialization: ... + @typing.overload + def _update_pet_with_form_oapg( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _update_pet_with_form_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _update_pet_with_form_oapg( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _update_pet_with_form_oapg( + self, + content_type: str = 'application/x-www-form-urlencoded', + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + Updates a pet in the store with form data + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + self._verify_typed_dict_inputs_oapg(RequestPathParameters.Params, path_params) + used_path = path.value + + _path_params = {} + for parameter in RequestPathParameters.parameters: + parameter_data = path_params.get(parameter.name, schemas.unset) + if parameter_data is schemas.unset: + continue + serialized_data = parameter.serialize(parameter_data) + _path_params.update(serialized_data) + + for k, v in _path_params.items(): + used_path = used_path.replace('{%s}' % k, v) + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + _fields = None + _body = None + if body is not schemas.unset: + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + auth_settings=_auth, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class UpdatePetWithForm(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def update_pet_with_form( + self, + content_type: typing_extensions.Literal["application/x-www-form-urlencoded"] = ..., + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> api_client.ApiResponseWithoutDeserialization: ... + @typing.overload + def update_pet_with_form( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def update_pet_with_form( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def update_pet_with_form( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def update_pet_with_form( + self, + content_type: str = 'application/x-www-form-urlencoded', + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._update_pet_with_form_oapg( + body=body, + path_params=path_params, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + content_type: typing_extensions.Literal["application/x-www-form-urlencoded"] = ..., + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> api_client.ApiResponseWithoutDeserialization: ... + @typing.overload + def post( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + content_type: str = 'application/x-www-form-urlencoded', + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._update_pet_with_form_oapg( + body=body, + path_params=path_params, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/pet_pet_id/post/__init__.pyi b/samples/openapi3/client/petstore/python/petstore_api/paths/pet_pet_id/post/__init__.pyi new file mode 100644 index 00000000000..a411ed2af72 --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/pet_pet_id/post/__init__.pyi @@ -0,0 +1,382 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from . import response_for_405 + + + +class RequestPathParameters: + class Schemas: + petId = schemas.Int64Schema + + + RequiredParams = typing_extensions.TypedDict( + 'RequiredParams', + { + 'petId': typing.Union[Schemas.petId, decimal.Decimal, int, ], + } + ) + OptionalParams = typing_extensions.TypedDict( + 'OptionalParams', + { + }, + total=False + ) + + + class Params(RequiredParams, OptionalParams): + pass + + + parameters = [ + api_client.PathParameter( + name="petId", + style=api_client.ParameterStyle.SIMPLE, + schema=Schemas.petId, + required=True, + ), + ] + +class RequestBody: + class Schemas: + + + class application_x_www_form_urlencoded( + schemas.DictSchema + ): + + + class MetaOapg: + + class properties: + name = schemas.StrSchema + status = schemas.StrSchema + __annotations__ = { + "name": name, + "status": status, + } + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["name"]) -> MetaOapg.properties.name: ... + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["status"]) -> MetaOapg.properties.status: ... + + @typing.overload + def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... + + def __getitem__(self, name: typing.Union[typing_extensions.Literal["name", "status", ], str]): + # dict_instance[name] accessor + return super().__getitem__(name) + + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["name"]) -> typing.Union[MetaOapg.properties.name, schemas.Unset]: ... + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["status"]) -> typing.Union[MetaOapg.properties.status, schemas.Unset]: ... + + @typing.overload + def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... + + def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["name", "status", ], str]): + return super().get_item_oapg(name) + + + def __new__( + cls, + *args: typing.Union[dict, frozendict.frozendict, ], + name: typing.Union[MetaOapg.properties.name, str, schemas.Unset] = schemas.unset, + status: typing.Union[MetaOapg.properties.status, str, schemas.Unset] = schemas.unset, + _configuration: typing.Optional[schemas.Configuration] = None, + **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], + ) -> 'application_x_www_form_urlencoded': + return super().__new__( + cls, + *args, + name=name, + status=status, + _configuration=_configuration, + **kwargs, + ) + + parameter = api_client.RequestBody( + content={ + 'application/x-www-form-urlencoded': api_client.MediaType( + schema=Schemas.application_x_www_form_urlencoded + ), + }, + ) + + +class BaseApi(api_client.Api): + @typing.overload + def _update_pet_with_form_oapg( + self, + content_type: typing_extensions.Literal["application/x-www-form-urlencoded"] = ..., + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> api_client.ApiResponseWithoutDeserialization: ... + @typing.overload + def _update_pet_with_form_oapg( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _update_pet_with_form_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _update_pet_with_form_oapg( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _update_pet_with_form_oapg( + self, + content_type: str = 'application/x-www-form-urlencoded', + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + Updates a pet in the store with form data + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + self._verify_typed_dict_inputs_oapg(RequestPathParameters.Params, path_params) + used_path = path.value + + _path_params = {} + for parameter in RequestPathParameters.parameters: + parameter_data = path_params.get(parameter.name, schemas.unset) + if parameter_data is schemas.unset: + continue + serialized_data = parameter.serialize(parameter_data) + _path_params.update(serialized_data) + + for k, v in _path_params.items(): + used_path = used_path.replace('{%s}' % k, v) + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + _fields = None + _body = None + if body is not schemas.unset: + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + auth_settings=_auth, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class UpdatePetWithForm(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def update_pet_with_form( + self, + content_type: typing_extensions.Literal["application/x-www-form-urlencoded"] = ..., + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> api_client.ApiResponseWithoutDeserialization: ... + @typing.overload + def update_pet_with_form( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def update_pet_with_form( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def update_pet_with_form( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def update_pet_with_form( + self, + content_type: str = 'application/x-www-form-urlencoded', + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._update_pet_with_form_oapg( + body=body, + path_params=path_params, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + content_type: typing_extensions.Literal["application/x-www-form-urlencoded"] = ..., + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> api_client.ApiResponseWithoutDeserialization: ... + @typing.overload + def post( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + content_type: str = 'application/x-www-form-urlencoded', + body: typing.Union[RequestBody.Schemas.application_x_www_form_urlencoded, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._update_pet_with_form_oapg( + body=body, + path_params=path_params, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/pet_pet_id/post/response_for_405.py b/samples/openapi3/client/petstore/python/petstore_api/paths/pet_pet_id/post/response_for_405.py new file mode 100644 index 00000000000..7ec95a8627a --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/pet_pet_id/post/response_for_405.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from petstore_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/pet_pet_id_upload_image/post.py b/samples/openapi3/client/petstore/python/petstore_api/paths/pet_pet_id_upload_image/post.py deleted file mode 100644 index 196f0beccff..00000000000 --- a/samples/openapi3/client/petstore/python/petstore_api/paths/pet_pet_id_upload_image/post.py +++ /dev/null @@ -1,446 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from petstore_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from petstore_api import schemas # noqa: F401 - -from petstore_api.model.api_response import ApiResponse - -from . import path - -# Path params -PetIdSchema = schemas.Int64Schema -RequestRequiredPathParams = typing_extensions.TypedDict( - 'RequestRequiredPathParams', - { - 'petId': typing.Union[PetIdSchema, decimal.Decimal, int, ], - } -) -RequestOptionalPathParams = typing_extensions.TypedDict( - 'RequestOptionalPathParams', - { - }, - total=False -) - - -class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): - pass - - -request_path_pet_id = api_client.PathParameter( - name="petId", - style=api_client.ParameterStyle.SIMPLE, - schema=PetIdSchema, - required=True, -) -# body param - - -class SchemaForRequestBodyMultipartFormData( - schemas.DictSchema -): - - - class MetaOapg: - - class properties: - additionalMetadata = schemas.StrSchema - file = schemas.BinarySchema - __annotations__ = { - "additionalMetadata": additionalMetadata, - "file": file, - } - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["additionalMetadata"]) -> MetaOapg.properties.additionalMetadata: ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["file"]) -> MetaOapg.properties.file: ... - - @typing.overload - def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... - - def __getitem__(self, name: typing.Union[typing_extensions.Literal["additionalMetadata", "file", ], str]): - # dict_instance[name] accessor - return super().__getitem__(name) - - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["additionalMetadata"]) -> typing.Union[MetaOapg.properties.additionalMetadata, schemas.Unset]: ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["file"]) -> typing.Union[MetaOapg.properties.file, schemas.Unset]: ... - - @typing.overload - def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... - - def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["additionalMetadata", "file", ], str]): - return super().get_item_oapg(name) - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, ], - additionalMetadata: typing.Union[MetaOapg.properties.additionalMetadata, str, schemas.Unset] = schemas.unset, - file: typing.Union[MetaOapg.properties.file, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'SchemaForRequestBodyMultipartFormData': - return super().__new__( - cls, - *args, - additionalMetadata=additionalMetadata, - file=file, - _configuration=_configuration, - **kwargs, - ) - - -request_body_body = api_client.RequestBody( - content={ - 'multipart/form-data': api_client.MediaType( - schema=SchemaForRequestBodyMultipartFormData), - }, -) -_auth = [ - 'petstore_auth', -] -SchemaFor200ResponseBodyApplicationJson = ApiResponse - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_status_code_to_response = { - '200': _response_for_200, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _upload_image_oapg( - self, - content_type: typing_extensions.Literal["multipart/form-data"] = ..., - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _upload_image_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _upload_image_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _upload_image_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _upload_image_oapg( - self, - content_type: str = 'multipart/form-data', - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - uploads an image - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) - used_path = path.value - - _path_params = {} - for parameter in ( - request_path_pet_id, - ): - parameter_data = path_params.get(parameter.name, schemas.unset) - if parameter_data is schemas.unset: - continue - serialized_data = parameter.serialize(parameter_data) - _path_params.update(serialized_data) - - for k, v in _path_params.items(): - used_path = used_path.replace('{%s}' % k, v) - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - _fields = None - _body = None - if body is not schemas.unset: - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class UploadImage(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def upload_image( - self, - content_type: typing_extensions.Literal["multipart/form-data"] = ..., - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def upload_image( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def upload_image( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def upload_image( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def upload_image( - self, - content_type: str = 'multipart/form-data', - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._upload_image_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - content_type: typing_extensions.Literal["multipart/form-data"] = ..., - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - content_type: str = 'multipart/form-data', - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._upload_image_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/pet_pet_id_upload_image/post.pyi b/samples/openapi3/client/petstore/python/petstore_api/paths/pet_pet_id_upload_image/post.pyi deleted file mode 100644 index 84c05ddf6ee..00000000000 --- a/samples/openapi3/client/petstore/python/petstore_api/paths/pet_pet_id_upload_image/post.pyi +++ /dev/null @@ -1,438 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from petstore_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from petstore_api import schemas # noqa: F401 - -from petstore_api.model.api_response import ApiResponse - -# Path params -PetIdSchema = schemas.Int64Schema -RequestRequiredPathParams = typing_extensions.TypedDict( - 'RequestRequiredPathParams', - { - 'petId': typing.Union[PetIdSchema, decimal.Decimal, int, ], - } -) -RequestOptionalPathParams = typing_extensions.TypedDict( - 'RequestOptionalPathParams', - { - }, - total=False -) - - -class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): - pass - - -request_path_pet_id = api_client.PathParameter( - name="petId", - style=api_client.ParameterStyle.SIMPLE, - schema=PetIdSchema, - required=True, -) -# body param - - -class SchemaForRequestBodyMultipartFormData( - schemas.DictSchema -): - - - class MetaOapg: - - class properties: - additionalMetadata = schemas.StrSchema - file = schemas.BinarySchema - __annotations__ = { - "additionalMetadata": additionalMetadata, - "file": file, - } - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["additionalMetadata"]) -> MetaOapg.properties.additionalMetadata: ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["file"]) -> MetaOapg.properties.file: ... - - @typing.overload - def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... - - def __getitem__(self, name: typing.Union[typing_extensions.Literal["additionalMetadata", "file", ], str]): - # dict_instance[name] accessor - return super().__getitem__(name) - - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["additionalMetadata"]) -> typing.Union[MetaOapg.properties.additionalMetadata, schemas.Unset]: ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["file"]) -> typing.Union[MetaOapg.properties.file, schemas.Unset]: ... - - @typing.overload - def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... - - def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["additionalMetadata", "file", ], str]): - return super().get_item_oapg(name) - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, ], - additionalMetadata: typing.Union[MetaOapg.properties.additionalMetadata, str, schemas.Unset] = schemas.unset, - file: typing.Union[MetaOapg.properties.file, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'SchemaForRequestBodyMultipartFormData': - return super().__new__( - cls, - *args, - additionalMetadata=additionalMetadata, - file=file, - _configuration=_configuration, - **kwargs, - ) - - -request_body_body = api_client.RequestBody( - content={ - 'multipart/form-data': api_client.MediaType( - schema=SchemaForRequestBodyMultipartFormData), - }, -) -SchemaFor200ResponseBodyApplicationJson = ApiResponse - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _upload_image_oapg( - self, - content_type: typing_extensions.Literal["multipart/form-data"] = ..., - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _upload_image_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _upload_image_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _upload_image_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _upload_image_oapg( - self, - content_type: str = 'multipart/form-data', - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - uploads an image - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) - used_path = path.value - - _path_params = {} - for parameter in ( - request_path_pet_id, - ): - parameter_data = path_params.get(parameter.name, schemas.unset) - if parameter_data is schemas.unset: - continue - serialized_data = parameter.serialize(parameter_data) - _path_params.update(serialized_data) - - for k, v in _path_params.items(): - used_path = used_path.replace('{%s}' % k, v) - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - _fields = None - _body = None - if body is not schemas.unset: - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class UploadImage(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def upload_image( - self, - content_type: typing_extensions.Literal["multipart/form-data"] = ..., - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def upload_image( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def upload_image( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def upload_image( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def upload_image( - self, - content_type: str = 'multipart/form-data', - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._upload_image_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - content_type: typing_extensions.Literal["multipart/form-data"] = ..., - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - content_type: str = 'multipart/form-data', - body: typing.Union[SchemaForRequestBodyMultipartFormData, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._upload_image_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/pet_pet_id_upload_image/post/__init__.py b/samples/openapi3/client/petstore/python/petstore_api/paths/pet_pet_id_upload_image/post/__init__.py new file mode 100644 index 00000000000..6769678ad3c --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/pet_pet_id_upload_image/post/__init__.py @@ -0,0 +1,435 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 + + + +class RequestPathParameters: + class Schemas: + petId = schemas.Int64Schema + + + RequiredParams = typing_extensions.TypedDict( + 'RequiredParams', + { + 'petId': typing.Union[Schemas.petId, decimal.Decimal, int, ], + } + ) + OptionalParams = typing_extensions.TypedDict( + 'OptionalParams', + { + }, + total=False + ) + + + class Params(RequiredParams, OptionalParams): + pass + + + parameters = [ + api_client.PathParameter( + name="petId", + style=api_client.ParameterStyle.SIMPLE, + schema=Schemas.petId, + required=True, + ), + ] + +class RequestBody: + class Schemas: + + + class multipart_form_data( + schemas.DictSchema + ): + + + class MetaOapg: + + class properties: + additionalMetadata = schemas.StrSchema + file = schemas.BinarySchema + __annotations__ = { + "additionalMetadata": additionalMetadata, + "file": file, + } + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["additionalMetadata"]) -> MetaOapg.properties.additionalMetadata: ... + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["file"]) -> MetaOapg.properties.file: ... + + @typing.overload + def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... + + def __getitem__(self, name: typing.Union[typing_extensions.Literal["additionalMetadata", "file", ], str]): + # dict_instance[name] accessor + return super().__getitem__(name) + + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["additionalMetadata"]) -> typing.Union[MetaOapg.properties.additionalMetadata, schemas.Unset]: ... + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["file"]) -> typing.Union[MetaOapg.properties.file, schemas.Unset]: ... + + @typing.overload + def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... + + def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["additionalMetadata", "file", ], str]): + return super().get_item_oapg(name) + + + def __new__( + cls, + *args: typing.Union[dict, frozendict.frozendict, ], + additionalMetadata: typing.Union[MetaOapg.properties.additionalMetadata, str, schemas.Unset] = schemas.unset, + file: typing.Union[MetaOapg.properties.file, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, + _configuration: typing.Optional[schemas.Configuration] = None, + **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], + ) -> 'multipart_form_data': + return super().__new__( + cls, + *args, + additionalMetadata=additionalMetadata, + file=file, + _configuration=_configuration, + **kwargs, + ) + + parameter = api_client.RequestBody( + content={ + 'multipart/form-data': api_client.MediaType( + schema=Schemas.multipart_form_data + ), + }, + ) + +_auth = [ + 'petstore_auth', +] + +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _upload_image_oapg( + self, + content_type: typing_extensions.Literal["multipart/form-data"] = ..., + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _upload_image_oapg( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _upload_image_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _upload_image_oapg( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _upload_image_oapg( + self, + content_type: str = 'multipart/form-data', + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + uploads an image + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + self._verify_typed_dict_inputs_oapg(RequestPathParameters.Params, path_params) + used_path = path.value + + _path_params = {} + for parameter in RequestPathParameters.parameters: + parameter_data = path_params.get(parameter.name, schemas.unset) + if parameter_data is schemas.unset: + continue + serialized_data = parameter.serialize(parameter_data) + _path_params.update(serialized_data) + + for k, v in _path_params.items(): + used_path = used_path.replace('{%s}' % k, v) + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + _fields = None + _body = None + if body is not schemas.unset: + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + auth_settings=_auth, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class UploadImage(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def upload_image( + self, + content_type: typing_extensions.Literal["multipart/form-data"] = ..., + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def upload_image( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def upload_image( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def upload_image( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def upload_image( + self, + content_type: str = 'multipart/form-data', + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._upload_image_oapg( + body=body, + path_params=path_params, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + content_type: typing_extensions.Literal["multipart/form-data"] = ..., + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + content_type: str = 'multipart/form-data', + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._upload_image_oapg( + body=body, + path_params=path_params, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/pet_pet_id_upload_image/post/__init__.pyi b/samples/openapi3/client/petstore/python/petstore_api/paths/pet_pet_id_upload_image/post/__init__.pyi new file mode 100644 index 00000000000..d9b6f1e5bfd --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/pet_pet_id_upload_image/post/__init__.pyi @@ -0,0 +1,426 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from . import response_for_200 + + + +class RequestPathParameters: + class Schemas: + petId = schemas.Int64Schema + + + RequiredParams = typing_extensions.TypedDict( + 'RequiredParams', + { + 'petId': typing.Union[Schemas.petId, decimal.Decimal, int, ], + } + ) + OptionalParams = typing_extensions.TypedDict( + 'OptionalParams', + { + }, + total=False + ) + + + class Params(RequiredParams, OptionalParams): + pass + + + parameters = [ + api_client.PathParameter( + name="petId", + style=api_client.ParameterStyle.SIMPLE, + schema=Schemas.petId, + required=True, + ), + ] + +class RequestBody: + class Schemas: + + + class multipart_form_data( + schemas.DictSchema + ): + + + class MetaOapg: + + class properties: + additionalMetadata = schemas.StrSchema + file = schemas.BinarySchema + __annotations__ = { + "additionalMetadata": additionalMetadata, + "file": file, + } + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["additionalMetadata"]) -> MetaOapg.properties.additionalMetadata: ... + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["file"]) -> MetaOapg.properties.file: ... + + @typing.overload + def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... + + def __getitem__(self, name: typing.Union[typing_extensions.Literal["additionalMetadata", "file", ], str]): + # dict_instance[name] accessor + return super().__getitem__(name) + + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["additionalMetadata"]) -> typing.Union[MetaOapg.properties.additionalMetadata, schemas.Unset]: ... + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["file"]) -> typing.Union[MetaOapg.properties.file, schemas.Unset]: ... + + @typing.overload + def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... + + def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["additionalMetadata", "file", ], str]): + return super().get_item_oapg(name) + + + def __new__( + cls, + *args: typing.Union[dict, frozendict.frozendict, ], + additionalMetadata: typing.Union[MetaOapg.properties.additionalMetadata, str, schemas.Unset] = schemas.unset, + file: typing.Union[MetaOapg.properties.file, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, + _configuration: typing.Optional[schemas.Configuration] = None, + **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], + ) -> 'multipart_form_data': + return super().__new__( + cls, + *args, + additionalMetadata=additionalMetadata, + file=file, + _configuration=_configuration, + **kwargs, + ) + + parameter = api_client.RequestBody( + content={ + 'multipart/form-data': api_client.MediaType( + schema=Schemas.multipart_form_data + ), + }, + ) +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _upload_image_oapg( + self, + content_type: typing_extensions.Literal["multipart/form-data"] = ..., + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _upload_image_oapg( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _upload_image_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _upload_image_oapg( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _upload_image_oapg( + self, + content_type: str = 'multipart/form-data', + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + uploads an image + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + self._verify_typed_dict_inputs_oapg(RequestPathParameters.Params, path_params) + used_path = path.value + + _path_params = {} + for parameter in RequestPathParameters.parameters: + parameter_data = path_params.get(parameter.name, schemas.unset) + if parameter_data is schemas.unset: + continue + serialized_data = parameter.serialize(parameter_data) + _path_params.update(serialized_data) + + for k, v in _path_params.items(): + used_path = used_path.replace('{%s}' % k, v) + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + _fields = None + _body = None + if body is not schemas.unset: + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + auth_settings=_auth, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class UploadImage(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def upload_image( + self, + content_type: typing_extensions.Literal["multipart/form-data"] = ..., + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def upload_image( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def upload_image( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def upload_image( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def upload_image( + self, + content_type: str = 'multipart/form-data', + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._upload_image_oapg( + body=body, + path_params=path_params, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + content_type: typing_extensions.Literal["multipart/form-data"] = ..., + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + content_type: str = ..., + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + content_type: str = 'multipart/form-data', + body: typing.Union[RequestBody.Schemas.multipart_form_data, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._upload_image_oapg( + body=body, + path_params=path_params, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/pet_pet_id_upload_image/post/response_for_200.py b/samples/openapi3/client/petstore/python/petstore_api/paths/pet_pet_id_upload_image/post/response_for_200.py new file mode 100644 index 00000000000..55c94e2ea12 --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/pet_pet_id_upload_image/post/response_for_200.py @@ -0,0 +1,43 @@ +import dataclasses +import urllib3 + +from petstore_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from petstore_api.model.api_response import ApiResponse + + +class BodySchemas: + # body schemas + application_json = ApiResponse + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/store_inventory/get/__init__.py b/samples/openapi3/client/petstore/python/petstore_api/paths/store_inventory/get/__init__.py new file mode 100644 index 00000000000..50b42404caf --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/store_inventory/get/__init__.py @@ -0,0 +1,221 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 + + +_auth = [ + 'api_key', +] + +_status_code_to_response = { + '200': response_for_200.response, +} +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _get_inventory_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _get_inventory_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _get_inventory_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _get_inventory_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + Returns pet inventories by status + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='get'.upper(), + headers=_headers, + auth_settings=_auth, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class GetInventory(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def get_inventory( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def get_inventory( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def get_inventory( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def get_inventory( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._get_inventory_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForget(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def get( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def get( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def get( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def get( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._get_inventory_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/store_inventory/get/__init__.pyi b/samples/openapi3/client/petstore/python/petstore_api/paths/store_inventory/get/__init__.pyi new file mode 100644 index 00000000000..1ec6f93243e --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/store_inventory/get/__init__.pyi @@ -0,0 +1,212 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from . import response_for_200 + +_all_accept_content_types = ( + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _get_inventory_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _get_inventory_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _get_inventory_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _get_inventory_oapg( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + Returns pet inventories by status + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='get'.upper(), + headers=_headers, + auth_settings=_auth, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class GetInventory(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def get_inventory( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def get_inventory( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def get_inventory( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def get_inventory( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._get_inventory_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForget(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def get( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def get( + self, + skip_deserialization: typing_extensions.Literal[True], + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def get( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def get( + self, + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._get_inventory_oapg( + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/store_inventory/get/response_for_200.py b/samples/openapi3/client/petstore/python/petstore_api/paths/store_inventory/get/response_for_200.py new file mode 100644 index 00000000000..716aea63925 --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/store_inventory/get/response_for_200.py @@ -0,0 +1,69 @@ +import dataclasses +import urllib3 + +from petstore_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + + +class BodySchemas: + # body schemas + + + class application_json( + schemas.DictSchema + ): + + + class MetaOapg: + additional_properties = schemas.Int32Schema + + def __getitem__(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: + # dict_instance[name] accessor + return super().__getitem__(name) + + def get_item_oapg(self, name: typing.Union[str, ]) -> MetaOapg.additional_properties: + return super().get_item_oapg(name) + + def __new__( + cls, + *args: typing.Union[dict, frozendict.frozendict, ], + _configuration: typing.Optional[schemas.Configuration] = None, + **kwargs: typing.Union[MetaOapg.additional_properties, decimal.Decimal, int, ], + ) -> 'application_json': + return super().__new__( + cls, + *args, + _configuration=_configuration, + **kwargs, + ) + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/store_order/post.py b/samples/openapi3/client/petstore/python/petstore_api/paths/store_order/post.py deleted file mode 100644 index a92da10efbd..00000000000 --- a/samples/openapi3/client/petstore/python/petstore_api/paths/store_order/post.py +++ /dev/null @@ -1,347 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from petstore_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from petstore_api import schemas # noqa: F401 - -from petstore_api.model.order import Order - -from . import path - -# body param -SchemaForRequestBodyApplicationJson = Order - - -request_body_order = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) -SchemaFor200ResponseBodyApplicationXml = Order -SchemaFor200ResponseBodyApplicationJson = Order - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationXml, - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/xml': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationXml), - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) - - -@dataclass -class ApiResponseFor400(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_400 = api_client.OpenApiResponse( - response_cls=ApiResponseFor400, -) -_status_code_to_response = { - '200': _response_for_200, - '400': _response_for_400, -} -_all_accept_content_types = ( - 'application/xml', - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _place_order_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _place_order_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _place_order_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _place_order_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _place_order_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - Place an order for a pet - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_order.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PlaceOrder(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def place_order( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def place_order( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def place_order( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def place_order( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def place_order( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._place_order_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._place_order_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/store_order/post.pyi b/samples/openapi3/client/petstore/python/petstore_api/paths/store_order/post.pyi deleted file mode 100644 index 20ad57939b0..00000000000 --- a/samples/openapi3/client/petstore/python/petstore_api/paths/store_order/post.pyi +++ /dev/null @@ -1,341 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from petstore_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from petstore_api import schemas # noqa: F401 - -from petstore_api.model.order import Order - -# body param -SchemaForRequestBodyApplicationJson = Order - - -request_body_order = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) -SchemaFor200ResponseBodyApplicationXml = Order -SchemaFor200ResponseBodyApplicationJson = Order - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationXml, - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/xml': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationXml), - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) - - -@dataclass -class ApiResponseFor400(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_400 = api_client.OpenApiResponse( - response_cls=ApiResponseFor400, -) -_all_accept_content_types = ( - 'application/xml', - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _place_order_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _place_order_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _place_order_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _place_order_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _place_order_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - Place an order for a pet - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_order.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class PlaceOrder(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def place_order( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def place_order( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def place_order( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def place_order( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def place_order( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._place_order_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._place_order_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/store_order/post/__init__.py b/samples/openapi3/client/petstore/python/petstore_api/paths/store_order/post/__init__.py new file mode 100644 index 00000000000..e6dc9ea12cf --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/store_order/post/__init__.py @@ -0,0 +1,318 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from petstore_api.model.order import Order + +from .. import path +from . import response_for_200 +from . import response_for_400 + + + +class RequestBody: + class Schemas: + application_json = Order + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + +_status_code_to_response = { + '200': response_for_200.response, + '400': response_for_400.response, +} +_all_accept_content_types = ( + 'application/xml', + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _place_order_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _place_order_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _place_order_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _place_order_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _place_order_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + Place an order for a pet + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PlaceOrder(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def place_order( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def place_order( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def place_order( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def place_order( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def place_order( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._place_order_oapg( + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._place_order_oapg( + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/store_order/post/__init__.pyi b/samples/openapi3/client/petstore/python/petstore_api/paths/store_order/post/__init__.pyi new file mode 100644 index 00000000000..86a048365ca --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/store_order/post/__init__.pyi @@ -0,0 +1,312 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from petstore_api.model.order import Order + +from . import response_for_200 +from . import response_for_400 + + + +class RequestBody: + class Schemas: + application_json = Order + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) +_all_accept_content_types = ( + 'application/xml', + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _place_order_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _place_order_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def _place_order_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _place_order_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _place_order_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + Place an order for a pet + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class PlaceOrder(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def place_order( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def place_order( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def place_order( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def place_order( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def place_order( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._place_order_oapg( + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._place_order_oapg( + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/store_order/post/response_for_200.py b/samples/openapi3/client/petstore/python/petstore_api/paths/store_order/post/response_for_200.py new file mode 100644 index 00000000000..8dcf32de5a1 --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/store_order/post/response_for_200.py @@ -0,0 +1,48 @@ +import dataclasses +import urllib3 + +from petstore_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from petstore_api.model.order import Order + + +class BodySchemas: + # body schemas + application_xml = Order + application_json = Order + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_xml, + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/xml': api_client.MediaType( + schema=BodySchemas.application_xml, + ), + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/store_order/post/response_for_400.py b/samples/openapi3/client/petstore/python/petstore_api/paths/store_order/post/response_for_400.py new file mode 100644 index 00000000000..7ec95a8627a --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/store_order/post/response_for_400.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from petstore_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/store_order_order_id/delete.py b/samples/openapi3/client/petstore/python/petstore_api/paths/store_order_order_id/delete.py deleted file mode 100644 index 2e2edd945d7..00000000000 --- a/samples/openapi3/client/petstore/python/petstore_api/paths/store_order_order_id/delete.py +++ /dev/null @@ -1,257 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 - -from petstore_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from petstore_api import schemas # noqa: F401 - -from . import path - -# Path params -OrderIdSchema = schemas.StrSchema -RequestRequiredPathParams = typing_extensions.TypedDict( - 'RequestRequiredPathParams', - { - 'order_id': typing.Union[OrderIdSchema, str, ], - } -) -RequestOptionalPathParams = typing_extensions.TypedDict( - 'RequestOptionalPathParams', - { - }, - total=False -) - - -class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): - pass - - -request_path_order_id = api_client.PathParameter( - name="order_id", - style=api_client.ParameterStyle.SIMPLE, - schema=OrderIdSchema, - required=True, -) - - -@dataclass -class ApiResponseFor400(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_400 = api_client.OpenApiResponse( - response_cls=ApiResponseFor400, -) - - -@dataclass -class ApiResponseFor404(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_404 = api_client.OpenApiResponse( - response_cls=ApiResponseFor404, -) -_status_code_to_response = { - '400': _response_for_400, - '404': _response_for_404, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _delete_order_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def _delete_order_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _delete_order_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _delete_order_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - Delete purchase order by ID - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) - used_path = path.value - - _path_params = {} - for parameter in ( - request_path_order_id, - ): - parameter_data = path_params.get(parameter.name, schemas.unset) - if parameter_data is schemas.unset: - continue - serialized_data = parameter.serialize(parameter_data) - _path_params.update(serialized_data) - - for k, v in _path_params.items(): - used_path = used_path.replace('{%s}' % k, v) - # TODO add cookie handling - - response = self.api_client.call_api( - resource_path=used_path, - method='delete'.upper(), - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class DeleteOrder(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def delete_order( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def delete_order( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def delete_order( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def delete_order( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._delete_order_oapg( - path_params=path_params, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiFordelete(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def delete( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def delete( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def delete( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def delete( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._delete_order_oapg( - path_params=path_params, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/store_order_order_id/delete.pyi b/samples/openapi3/client/petstore/python/petstore_api/paths/store_order_order_id/delete.pyi deleted file mode 100644 index 6eefe3953d1..00000000000 --- a/samples/openapi3/client/petstore/python/petstore_api/paths/store_order_order_id/delete.pyi +++ /dev/null @@ -1,251 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 - -from petstore_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from petstore_api import schemas # noqa: F401 - -# Path params -OrderIdSchema = schemas.StrSchema -RequestRequiredPathParams = typing_extensions.TypedDict( - 'RequestRequiredPathParams', - { - 'order_id': typing.Union[OrderIdSchema, str, ], - } -) -RequestOptionalPathParams = typing_extensions.TypedDict( - 'RequestOptionalPathParams', - { - }, - total=False -) - - -class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): - pass - - -request_path_order_id = api_client.PathParameter( - name="order_id", - style=api_client.ParameterStyle.SIMPLE, - schema=OrderIdSchema, - required=True, -) - - -@dataclass -class ApiResponseFor400(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_400 = api_client.OpenApiResponse( - response_cls=ApiResponseFor400, -) - - -@dataclass -class ApiResponseFor404(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_404 = api_client.OpenApiResponse( - response_cls=ApiResponseFor404, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _delete_order_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def _delete_order_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _delete_order_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _delete_order_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - Delete purchase order by ID - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) - used_path = path.value - - _path_params = {} - for parameter in ( - request_path_order_id, - ): - parameter_data = path_params.get(parameter.name, schemas.unset) - if parameter_data is schemas.unset: - continue - serialized_data = parameter.serialize(parameter_data) - _path_params.update(serialized_data) - - for k, v in _path_params.items(): - used_path = used_path.replace('{%s}' % k, v) - # TODO add cookie handling - - response = self.api_client.call_api( - resource_path=used_path, - method='delete'.upper(), - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class DeleteOrder(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def delete_order( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def delete_order( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def delete_order( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def delete_order( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._delete_order_oapg( - path_params=path_params, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiFordelete(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def delete( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def delete( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def delete( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def delete( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._delete_order_oapg( - path_params=path_params, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/store_order_order_id/delete/__init__.py b/samples/openapi3/client/petstore/python/petstore_api/paths/store_order_order_id/delete/__init__.py new file mode 100644 index 00000000000..e35fcccd09e --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/store_order_order_id/delete/__init__.py @@ -0,0 +1,240 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from .. import path +from . import response_for_400 +from . import response_for_404 + + + +class RequestPathParameters: + class Schemas: + order_id = schemas.StrSchema + + + RequiredParams = typing_extensions.TypedDict( + 'RequiredParams', + { + 'order_id': typing.Union[Schemas.order_id, str, ], + } + ) + OptionalParams = typing_extensions.TypedDict( + 'OptionalParams', + { + }, + total=False + ) + + + class Params(RequiredParams, OptionalParams): + pass + + + parameters = [ + api_client.PathParameter( + name="order_id", + style=api_client.ParameterStyle.SIMPLE, + schema=Schemas.order_id, + required=True, + ), + ] +_status_code_to_response = { + '400': response_for_400.response, + '404': response_for_404.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _delete_order_oapg( + self, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> api_client.ApiResponseWithoutDeserialization: ... + @typing.overload + def _delete_order_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _delete_order_oapg( + self, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _delete_order_oapg( + self, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + Delete purchase order by ID + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + self._verify_typed_dict_inputs_oapg(RequestPathParameters.Params, path_params) + used_path = path.value + + _path_params = {} + for parameter in RequestPathParameters.parameters: + parameter_data = path_params.get(parameter.name, schemas.unset) + if parameter_data is schemas.unset: + continue + serialized_data = parameter.serialize(parameter_data) + _path_params.update(serialized_data) + + for k, v in _path_params.items(): + used_path = used_path.replace('{%s}' % k, v) + # TODO add cookie handling + + response = self.api_client.call_api( + resource_path=used_path, + method='delete'.upper(), + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class DeleteOrder(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def delete_order( + self, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> api_client.ApiResponseWithoutDeserialization: ... + @typing.overload + def delete_order( + self, + skip_deserialization: typing_extensions.Literal[True], + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def delete_order( + self, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def delete_order( + self, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._delete_order_oapg( + path_params=path_params, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiFordelete(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def delete( + self, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> api_client.ApiResponseWithoutDeserialization: ... + @typing.overload + def delete( + self, + skip_deserialization: typing_extensions.Literal[True], + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def delete( + self, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def delete( + self, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._delete_order_oapg( + path_params=path_params, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/store_order_order_id/delete/__init__.pyi b/samples/openapi3/client/petstore/python/petstore_api/paths/store_order_order_id/delete/__init__.pyi new file mode 100644 index 00000000000..4f968fe2616 --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/store_order_order_id/delete/__init__.pyi @@ -0,0 +1,234 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from . import response_for_400 +from . import response_for_404 + + + +class RequestPathParameters: + class Schemas: + order_id = schemas.StrSchema + + + RequiredParams = typing_extensions.TypedDict( + 'RequiredParams', + { + 'order_id': typing.Union[Schemas.order_id, str, ], + } + ) + OptionalParams = typing_extensions.TypedDict( + 'OptionalParams', + { + }, + total=False + ) + + + class Params(RequiredParams, OptionalParams): + pass + + + parameters = [ + api_client.PathParameter( + name="order_id", + style=api_client.ParameterStyle.SIMPLE, + schema=Schemas.order_id, + required=True, + ), + ] + +class BaseApi(api_client.Api): + @typing.overload + def _delete_order_oapg( + self, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> api_client.ApiResponseWithoutDeserialization: ... + @typing.overload + def _delete_order_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _delete_order_oapg( + self, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _delete_order_oapg( + self, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + Delete purchase order by ID + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + self._verify_typed_dict_inputs_oapg(RequestPathParameters.Params, path_params) + used_path = path.value + + _path_params = {} + for parameter in RequestPathParameters.parameters: + parameter_data = path_params.get(parameter.name, schemas.unset) + if parameter_data is schemas.unset: + continue + serialized_data = parameter.serialize(parameter_data) + _path_params.update(serialized_data) + + for k, v in _path_params.items(): + used_path = used_path.replace('{%s}' % k, v) + # TODO add cookie handling + + response = self.api_client.call_api( + resource_path=used_path, + method='delete'.upper(), + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class DeleteOrder(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def delete_order( + self, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> api_client.ApiResponseWithoutDeserialization: ... + @typing.overload + def delete_order( + self, + skip_deserialization: typing_extensions.Literal[True], + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def delete_order( + self, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def delete_order( + self, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._delete_order_oapg( + path_params=path_params, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiFordelete(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def delete( + self, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> api_client.ApiResponseWithoutDeserialization: ... + @typing.overload + def delete( + self, + skip_deserialization: typing_extensions.Literal[True], + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def delete( + self, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def delete( + self, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._delete_order_oapg( + path_params=path_params, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/store_order_order_id/delete/response_for_400.py b/samples/openapi3/client/petstore/python/petstore_api/paths/store_order_order_id/delete/response_for_400.py new file mode 100644 index 00000000000..7ec95a8627a --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/store_order_order_id/delete/response_for_400.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from petstore_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/store_order_order_id/delete/response_for_404.py b/samples/openapi3/client/petstore/python/petstore_api/paths/store_order_order_id/delete/response_for_404.py new file mode 100644 index 00000000000..7ec95a8627a --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/store_order_order_id/delete/response_for_404.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from petstore_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/store_order_order_id/get.py b/samples/openapi3/client/petstore/python/petstore_api/paths/store_order_order_id/get.py deleted file mode 100644 index 8c52441cf1e..00000000000 --- a/samples/openapi3/client/petstore/python/petstore_api/paths/store_order_order_id/get.py +++ /dev/null @@ -1,330 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from petstore_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from petstore_api import schemas # noqa: F401 - -from petstore_api.model.order import Order - -from . import path - -# Path params - - -class OrderIdSchema( - schemas.Int64Schema -): - - - class MetaOapg: - format = 'int64' - inclusive_maximum = 5 - inclusive_minimum = 1 -RequestRequiredPathParams = typing_extensions.TypedDict( - 'RequestRequiredPathParams', - { - 'order_id': typing.Union[OrderIdSchema, decimal.Decimal, int, ], - } -) -RequestOptionalPathParams = typing_extensions.TypedDict( - 'RequestOptionalPathParams', - { - }, - total=False -) - - -class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): - pass - - -request_path_order_id = api_client.PathParameter( - name="order_id", - style=api_client.ParameterStyle.SIMPLE, - schema=OrderIdSchema, - required=True, -) -SchemaFor200ResponseBodyApplicationXml = Order -SchemaFor200ResponseBodyApplicationJson = Order - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationXml, - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/xml': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationXml), - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) - - -@dataclass -class ApiResponseFor400(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_400 = api_client.OpenApiResponse( - response_cls=ApiResponseFor400, -) - - -@dataclass -class ApiResponseFor404(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_404 = api_client.OpenApiResponse( - response_cls=ApiResponseFor404, -) -_status_code_to_response = { - '200': _response_for_200, - '400': _response_for_400, - '404': _response_for_404, -} -_all_accept_content_types = ( - 'application/xml', - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _get_order_by_id_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _get_order_by_id_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _get_order_by_id_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _get_order_by_id_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - Find purchase order by ID - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) - used_path = path.value - - _path_params = {} - for parameter in ( - request_path_order_id, - ): - parameter_data = path_params.get(parameter.name, schemas.unset) - if parameter_data is schemas.unset: - continue - serialized_data = parameter.serialize(parameter_data) - _path_params.update(serialized_data) - - for k, v in _path_params.items(): - used_path = used_path.replace('{%s}' % k, v) - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='get'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class GetOrderById(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def get_order_by_id( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def get_order_by_id( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_order_by_id( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_order_by_id( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_order_by_id_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForget(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def get( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def get( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_order_by_id_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/store_order_order_id/get.pyi b/samples/openapi3/client/petstore/python/petstore_api/paths/store_order_order_id/get.pyi deleted file mode 100644 index a4e2735912c..00000000000 --- a/samples/openapi3/client/petstore/python/petstore_api/paths/store_order_order_id/get.pyi +++ /dev/null @@ -1,318 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from petstore_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from petstore_api import schemas # noqa: F401 - -from petstore_api.model.order import Order - -# Path params - - -class OrderIdSchema( - schemas.Int64Schema -): - pass -RequestRequiredPathParams = typing_extensions.TypedDict( - 'RequestRequiredPathParams', - { - 'order_id': typing.Union[OrderIdSchema, decimal.Decimal, int, ], - } -) -RequestOptionalPathParams = typing_extensions.TypedDict( - 'RequestOptionalPathParams', - { - }, - total=False -) - - -class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): - pass - - -request_path_order_id = api_client.PathParameter( - name="order_id", - style=api_client.ParameterStyle.SIMPLE, - schema=OrderIdSchema, - required=True, -) -SchemaFor200ResponseBodyApplicationXml = Order -SchemaFor200ResponseBodyApplicationJson = Order - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationXml, - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/xml': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationXml), - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) - - -@dataclass -class ApiResponseFor400(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_400 = api_client.OpenApiResponse( - response_cls=ApiResponseFor400, -) - - -@dataclass -class ApiResponseFor404(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_404 = api_client.OpenApiResponse( - response_cls=ApiResponseFor404, -) -_all_accept_content_types = ( - 'application/xml', - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _get_order_by_id_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _get_order_by_id_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _get_order_by_id_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _get_order_by_id_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - Find purchase order by ID - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) - used_path = path.value - - _path_params = {} - for parameter in ( - request_path_order_id, - ): - parameter_data = path_params.get(parameter.name, schemas.unset) - if parameter_data is schemas.unset: - continue - serialized_data = parameter.serialize(parameter_data) - _path_params.update(serialized_data) - - for k, v in _path_params.items(): - used_path = used_path.replace('{%s}' % k, v) - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='get'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class GetOrderById(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def get_order_by_id( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def get_order_by_id( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_order_by_id( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_order_by_id( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_order_by_id_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForget(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def get( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def get( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_order_by_id_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/store_order_order_id/get/__init__.py b/samples/openapi3/client/petstore/python/petstore_api/paths/store_order_order_id/get/__init__.py new file mode 100644 index 00000000000..802d11d36b0 --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/store_order_order_id/get/__init__.py @@ -0,0 +1,289 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 +from . import response_for_400 +from . import response_for_404 + + + +class RequestPathParameters: + class Schemas: + + + class order_id( + schemas.Int64Schema + ): + + + class MetaOapg: + format = 'int64' + inclusive_maximum = 5 + inclusive_minimum = 1 + + + RequiredParams = typing_extensions.TypedDict( + 'RequiredParams', + { + 'order_id': typing.Union[Schemas.order_id, decimal.Decimal, int, ], + } + ) + OptionalParams = typing_extensions.TypedDict( + 'OptionalParams', + { + }, + total=False + ) + + + class Params(RequiredParams, OptionalParams): + pass + + + parameters = [ + api_client.PathParameter( + name="order_id", + style=api_client.ParameterStyle.SIMPLE, + schema=Schemas.order_id, + required=True, + ), + ] +_status_code_to_response = { + '200': response_for_200.response, + '400': response_for_400.response, + '404': response_for_404.response, +} +_all_accept_content_types = ( + 'application/xml', + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _get_order_by_id_oapg( + self, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _get_order_by_id_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _get_order_by_id_oapg( + self, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _get_order_by_id_oapg( + self, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + Find purchase order by ID + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + self._verify_typed_dict_inputs_oapg(RequestPathParameters.Params, path_params) + used_path = path.value + + _path_params = {} + for parameter in RequestPathParameters.parameters: + parameter_data = path_params.get(parameter.name, schemas.unset) + if parameter_data is schemas.unset: + continue + serialized_data = parameter.serialize(parameter_data) + _path_params.update(serialized_data) + + for k, v in _path_params.items(): + used_path = used_path.replace('{%s}' % k, v) + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='get'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class GetOrderById(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def get_order_by_id( + self, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def get_order_by_id( + self, + skip_deserialization: typing_extensions.Literal[True], + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def get_order_by_id( + self, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def get_order_by_id( + self, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._get_order_by_id_oapg( + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForget(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def get( + self, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def get( + self, + skip_deserialization: typing_extensions.Literal[True], + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def get( + self, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def get( + self, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._get_order_by_id_oapg( + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/store_order_order_id/get/__init__.pyi b/samples/openapi3/client/petstore/python/petstore_api/paths/store_order_order_id/get/__init__.pyi new file mode 100644 index 00000000000..2960f72b98c --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/store_order_order_id/get/__init__.pyi @@ -0,0 +1,277 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from . import response_for_200 +from . import response_for_400 +from . import response_for_404 + + + +class RequestPathParameters: + class Schemas: + + + class order_id( + schemas.Int64Schema + ): + pass + + + RequiredParams = typing_extensions.TypedDict( + 'RequiredParams', + { + 'order_id': typing.Union[Schemas.order_id, decimal.Decimal, int, ], + } + ) + OptionalParams = typing_extensions.TypedDict( + 'OptionalParams', + { + }, + total=False + ) + + + class Params(RequiredParams, OptionalParams): + pass + + + parameters = [ + api_client.PathParameter( + name="order_id", + style=api_client.ParameterStyle.SIMPLE, + schema=Schemas.order_id, + required=True, + ), + ]_all_accept_content_types = ( + 'application/xml', + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _get_order_by_id_oapg( + self, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _get_order_by_id_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _get_order_by_id_oapg( + self, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _get_order_by_id_oapg( + self, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + Find purchase order by ID + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + self._verify_typed_dict_inputs_oapg(RequestPathParameters.Params, path_params) + used_path = path.value + + _path_params = {} + for parameter in RequestPathParameters.parameters: + parameter_data = path_params.get(parameter.name, schemas.unset) + if parameter_data is schemas.unset: + continue + serialized_data = parameter.serialize(parameter_data) + _path_params.update(serialized_data) + + for k, v in _path_params.items(): + used_path = used_path.replace('{%s}' % k, v) + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='get'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class GetOrderById(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def get_order_by_id( + self, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def get_order_by_id( + self, + skip_deserialization: typing_extensions.Literal[True], + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def get_order_by_id( + self, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def get_order_by_id( + self, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._get_order_by_id_oapg( + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForget(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def get( + self, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def get( + self, + skip_deserialization: typing_extensions.Literal[True], + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def get( + self, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def get( + self, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._get_order_by_id_oapg( + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/store_order_order_id/get/response_for_200.py b/samples/openapi3/client/petstore/python/petstore_api/paths/store_order_order_id/get/response_for_200.py new file mode 100644 index 00000000000..8dcf32de5a1 --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/store_order_order_id/get/response_for_200.py @@ -0,0 +1,48 @@ +import dataclasses +import urllib3 + +from petstore_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from petstore_api.model.order import Order + + +class BodySchemas: + # body schemas + application_xml = Order + application_json = Order + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_xml, + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/xml': api_client.MediaType( + schema=BodySchemas.application_xml, + ), + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/store_order_order_id/get/response_for_400.py b/samples/openapi3/client/petstore/python/petstore_api/paths/store_order_order_id/get/response_for_400.py new file mode 100644 index 00000000000..7ec95a8627a --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/store_order_order_id/get/response_for_400.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from petstore_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/store_order_order_id/get/response_for_404.py b/samples/openapi3/client/petstore/python/petstore_api/paths/store_order_order_id/get/response_for_404.py new file mode 100644 index 00000000000..7ec95a8627a --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/store_order_order_id/get/response_for_404.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from petstore_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/user/post.py b/samples/openapi3/client/petstore/python/petstore_api/paths/user/post.py deleted file mode 100644 index 08cfcc902cd..00000000000 --- a/samples/openapi3/client/petstore/python/petstore_api/paths/user/post.py +++ /dev/null @@ -1,303 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from petstore_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from petstore_api import schemas # noqa: F401 - -from petstore_api.model.user import User - -from . import path - -# body param -SchemaForRequestBodyApplicationJson = User - - -request_body_user = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseForDefault(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_default = api_client.OpenApiResponse( - response_cls=ApiResponseForDefault, -) -_status_code_to_response = { - 'default': _response_for_default, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _create_user_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseForDefault, - ]: ... - - @typing.overload - def _create_user_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseForDefault, - ]: ... - - - @typing.overload - def _create_user_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _create_user_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _create_user_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - Create user - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_user.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class CreateUser(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def create_user( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseForDefault, - ]: ... - - @typing.overload - def create_user( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseForDefault, - ]: ... - - - @typing.overload - def create_user( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def create_user( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def create_user( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._create_user_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseForDefault, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseForDefault, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._create_user_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/user/post.pyi b/samples/openapi3/client/petstore/python/petstore_api/paths/user/post.pyi deleted file mode 100644 index df85a246c2c..00000000000 --- a/samples/openapi3/client/petstore/python/petstore_api/paths/user/post.pyi +++ /dev/null @@ -1,298 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from petstore_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from petstore_api import schemas # noqa: F401 - -from petstore_api.model.user import User - -# body param -SchemaForRequestBodyApplicationJson = User - - -request_body_user = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseForDefault(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_default = api_client.OpenApiResponse( - response_cls=ApiResponseForDefault, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _create_user_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseForDefault, - ]: ... - - @typing.overload - def _create_user_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseForDefault, - ]: ... - - - @typing.overload - def _create_user_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _create_user_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _create_user_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - Create user - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_user.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class CreateUser(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def create_user( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseForDefault, - ]: ... - - @typing.overload - def create_user( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseForDefault, - ]: ... - - - @typing.overload - def create_user( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def create_user( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def create_user( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._create_user_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseForDefault, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseForDefault, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._create_user_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/user/post/__init__.py b/samples/openapi3/client/petstore/python/petstore_api/paths/user/post/__init__.py new file mode 100644 index 00000000000..dc607656849 --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/user/post/__init__.py @@ -0,0 +1,296 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from petstore_api.model.user import User + +from .. import path +from . import response_for_default + + + +class RequestBody: + class Schemas: + application_json = User + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + +_status_code_to_response = { + 'default': response_for_default.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _create_user_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_default.ApiResponse, + ]: ... + + @typing.overload + def _create_user_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_default.ApiResponse, + ]: ... + + + @typing.overload + def _create_user_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _create_user_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_default.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _create_user_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + Create user + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class CreateUser(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def create_user( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_default.ApiResponse, + ]: ... + + @typing.overload + def create_user( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_default.ApiResponse, + ]: ... + + + @typing.overload + def create_user( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def create_user( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_default.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def create_user( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._create_user_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_default.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_default.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_default.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._create_user_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/user/post/__init__.pyi b/samples/openapi3/client/petstore/python/petstore_api/paths/user/post/__init__.pyi new file mode 100644 index 00000000000..0d0e9a2697f --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/user/post/__init__.pyi @@ -0,0 +1,291 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from petstore_api.model.user import User + +from . import response_for_default + + + +class RequestBody: + class Schemas: + application_json = User + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + + +class BaseApi(api_client.Api): + @typing.overload + def _create_user_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_default.ApiResponse, + ]: ... + + @typing.overload + def _create_user_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_default.ApiResponse, + ]: ... + + + @typing.overload + def _create_user_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _create_user_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_default.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _create_user_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + Create user + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class CreateUser(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def create_user( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_default.ApiResponse, + ]: ... + + @typing.overload + def create_user( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_default.ApiResponse, + ]: ... + + + @typing.overload + def create_user( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def create_user( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_default.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def create_user( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._create_user_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_default.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_default.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_default.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._create_user_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/user/post/response_for_default.py b/samples/openapi3/client/petstore/python/petstore_api/paths/user/post/response_for_default.py new file mode 100644 index 00000000000..7ec95a8627a --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/user/post/response_for_default.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from petstore_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/user_create_with_array/post.py b/samples/openapi3/client/petstore/python/petstore_api/paths/user_create_with_array/post.py deleted file mode 100644 index d596822b475..00000000000 --- a/samples/openapi3/client/petstore/python/petstore_api/paths/user_create_with_array/post.py +++ /dev/null @@ -1,328 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from petstore_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from petstore_api import schemas # noqa: F401 - -from petstore_api.model.user import User - -from . import path - -# body param - - -class SchemaForRequestBodyApplicationJson( - schemas.ListSchema -): - - - class MetaOapg: - - @staticmethod - def items() -> typing.Type['User']: - return User - - def __new__( - cls, - arg: typing.Union[typing.Tuple['User'], typing.List['User']], - _configuration: typing.Optional[schemas.Configuration] = None, - ) -> 'SchemaForRequestBodyApplicationJson': - return super().__new__( - cls, - arg, - _configuration=_configuration, - ) - - def __getitem__(self, i: int) -> 'User': - return super().__getitem__(i) - - -request_body_user = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseForDefault(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_default = api_client.OpenApiResponse( - response_cls=ApiResponseForDefault, -) -_status_code_to_response = { - 'default': _response_for_default, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _create_users_with_array_input_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,list, tuple, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseForDefault, - ]: ... - - @typing.overload - def _create_users_with_array_input_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,list, tuple, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseForDefault, - ]: ... - - - @typing.overload - def _create_users_with_array_input_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,list, tuple, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _create_users_with_array_input_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,list, tuple, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _create_users_with_array_input_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,list, tuple, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - Creates list of users with given input array - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_user.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class CreateUsersWithArrayInput(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def create_users_with_array_input( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,list, tuple, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseForDefault, - ]: ... - - @typing.overload - def create_users_with_array_input( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,list, tuple, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseForDefault, - ]: ... - - - @typing.overload - def create_users_with_array_input( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,list, tuple, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def create_users_with_array_input( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,list, tuple, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def create_users_with_array_input( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,list, tuple, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._create_users_with_array_input_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,list, tuple, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseForDefault, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,list, tuple, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseForDefault, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,list, tuple, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,list, tuple, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,list, tuple, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._create_users_with_array_input_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/user_create_with_array/post.pyi b/samples/openapi3/client/petstore/python/petstore_api/paths/user_create_with_array/post.pyi deleted file mode 100644 index 6c83bb4f8b0..00000000000 --- a/samples/openapi3/client/petstore/python/petstore_api/paths/user_create_with_array/post.pyi +++ /dev/null @@ -1,323 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from petstore_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from petstore_api import schemas # noqa: F401 - -from petstore_api.model.user import User - -# body param - - -class SchemaForRequestBodyApplicationJson( - schemas.ListSchema -): - - - class MetaOapg: - - @staticmethod - def items() -> typing.Type['User']: - return User - - def __new__( - cls, - arg: typing.Union[typing.Tuple['User'], typing.List['User']], - _configuration: typing.Optional[schemas.Configuration] = None, - ) -> 'SchemaForRequestBodyApplicationJson': - return super().__new__( - cls, - arg, - _configuration=_configuration, - ) - - def __getitem__(self, i: int) -> 'User': - return super().__getitem__(i) - - -request_body_user = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseForDefault(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_default = api_client.OpenApiResponse( - response_cls=ApiResponseForDefault, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _create_users_with_array_input_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,list, tuple, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseForDefault, - ]: ... - - @typing.overload - def _create_users_with_array_input_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,list, tuple, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseForDefault, - ]: ... - - - @typing.overload - def _create_users_with_array_input_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,list, tuple, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _create_users_with_array_input_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,list, tuple, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _create_users_with_array_input_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,list, tuple, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - Creates list of users with given input array - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_user.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class CreateUsersWithArrayInput(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def create_users_with_array_input( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,list, tuple, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseForDefault, - ]: ... - - @typing.overload - def create_users_with_array_input( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,list, tuple, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseForDefault, - ]: ... - - - @typing.overload - def create_users_with_array_input( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,list, tuple, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def create_users_with_array_input( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,list, tuple, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def create_users_with_array_input( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,list, tuple, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._create_users_with_array_input_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,list, tuple, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseForDefault, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,list, tuple, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseForDefault, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,list, tuple, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,list, tuple, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,list, tuple, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._create_users_with_array_input_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/user_create_with_array/post/__init__.py b/samples/openapi3/client/petstore/python/petstore_api/paths/user_create_with_array/post/__init__.py new file mode 100644 index 00000000000..7d4708019ed --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/user_create_with_array/post/__init__.py @@ -0,0 +1,321 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from petstore_api.model.user import User + +from .. import path +from . import response_for_default + + + +class RequestBody: + class Schemas: + + + class application_json( + schemas.ListSchema + ): + + + class MetaOapg: + + @staticmethod + def items() -> typing.Type['User']: + return User + + def __new__( + cls, + arg: typing.Union[typing.Tuple['User'], typing.List['User']], + _configuration: typing.Optional[schemas.Configuration] = None, + ) -> 'application_json': + return super().__new__( + cls, + arg, + _configuration=_configuration, + ) + + def __getitem__(self, i: int) -> 'User': + return super().__getitem__(i) + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + +_status_code_to_response = { + 'default': response_for_default.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _create_users_with_array_input_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,list, tuple, ], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_default.ApiResponse, + ]: ... + + @typing.overload + def _create_users_with_array_input_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,list, tuple, ], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_default.ApiResponse, + ]: ... + + + @typing.overload + def _create_users_with_array_input_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,list, tuple, ], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _create_users_with_array_input_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,list, tuple, ], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_default.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _create_users_with_array_input_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,list, tuple, ], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + Creates list of users with given input array + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class CreateUsersWithArrayInput(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def create_users_with_array_input( + self, + body: typing.Union[RequestBody.Schemas.application_json,list, tuple, ], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_default.ApiResponse, + ]: ... + + @typing.overload + def create_users_with_array_input( + self, + body: typing.Union[RequestBody.Schemas.application_json,list, tuple, ], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_default.ApiResponse, + ]: ... + + + @typing.overload + def create_users_with_array_input( + self, + body: typing.Union[RequestBody.Schemas.application_json,list, tuple, ], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def create_users_with_array_input( + self, + body: typing.Union[RequestBody.Schemas.application_json,list, tuple, ], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_default.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def create_users_with_array_input( + self, + body: typing.Union[RequestBody.Schemas.application_json,list, tuple, ], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._create_users_with_array_input_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,list, tuple, ], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_default.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,list, tuple, ], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_default.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,list, tuple, ], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,list, tuple, ], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_default.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,list, tuple, ], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._create_users_with_array_input_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/user_create_with_array/post/__init__.pyi b/samples/openapi3/client/petstore/python/petstore_api/paths/user_create_with_array/post/__init__.pyi new file mode 100644 index 00000000000..dc46a6936c7 --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/user_create_with_array/post/__init__.pyi @@ -0,0 +1,316 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from petstore_api.model.user import User + +from . import response_for_default + + + +class RequestBody: + class Schemas: + + + class application_json( + schemas.ListSchema + ): + + + class MetaOapg: + + @staticmethod + def items() -> typing.Type['User']: + return User + + def __new__( + cls, + arg: typing.Union[typing.Tuple['User'], typing.List['User']], + _configuration: typing.Optional[schemas.Configuration] = None, + ) -> 'application_json': + return super().__new__( + cls, + arg, + _configuration=_configuration, + ) + + def __getitem__(self, i: int) -> 'User': + return super().__getitem__(i) + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + + +class BaseApi(api_client.Api): + @typing.overload + def _create_users_with_array_input_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,list, tuple, ], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_default.ApiResponse, + ]: ... + + @typing.overload + def _create_users_with_array_input_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,list, tuple, ], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_default.ApiResponse, + ]: ... + + + @typing.overload + def _create_users_with_array_input_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,list, tuple, ], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _create_users_with_array_input_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,list, tuple, ], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_default.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _create_users_with_array_input_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,list, tuple, ], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + Creates list of users with given input array + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class CreateUsersWithArrayInput(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def create_users_with_array_input( + self, + body: typing.Union[RequestBody.Schemas.application_json,list, tuple, ], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_default.ApiResponse, + ]: ... + + @typing.overload + def create_users_with_array_input( + self, + body: typing.Union[RequestBody.Schemas.application_json,list, tuple, ], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_default.ApiResponse, + ]: ... + + + @typing.overload + def create_users_with_array_input( + self, + body: typing.Union[RequestBody.Schemas.application_json,list, tuple, ], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def create_users_with_array_input( + self, + body: typing.Union[RequestBody.Schemas.application_json,list, tuple, ], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_default.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def create_users_with_array_input( + self, + body: typing.Union[RequestBody.Schemas.application_json,list, tuple, ], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._create_users_with_array_input_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,list, tuple, ], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_default.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,list, tuple, ], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_default.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,list, tuple, ], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,list, tuple, ], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_default.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,list, tuple, ], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._create_users_with_array_input_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/user_create_with_array/post/response_for_default.py b/samples/openapi3/client/petstore/python/petstore_api/paths/user_create_with_array/post/response_for_default.py new file mode 100644 index 00000000000..7ec95a8627a --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/user_create_with_array/post/response_for_default.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from petstore_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/user_create_with_list/post.py b/samples/openapi3/client/petstore/python/petstore_api/paths/user_create_with_list/post.py deleted file mode 100644 index fd0fe46f1b4..00000000000 --- a/samples/openapi3/client/petstore/python/petstore_api/paths/user_create_with_list/post.py +++ /dev/null @@ -1,328 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from petstore_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from petstore_api import schemas # noqa: F401 - -from petstore_api.model.user import User - -from . import path - -# body param - - -class SchemaForRequestBodyApplicationJson( - schemas.ListSchema -): - - - class MetaOapg: - - @staticmethod - def items() -> typing.Type['User']: - return User - - def __new__( - cls, - arg: typing.Union[typing.Tuple['User'], typing.List['User']], - _configuration: typing.Optional[schemas.Configuration] = None, - ) -> 'SchemaForRequestBodyApplicationJson': - return super().__new__( - cls, - arg, - _configuration=_configuration, - ) - - def __getitem__(self, i: int) -> 'User': - return super().__getitem__(i) - - -request_body_user = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseForDefault(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_default = api_client.OpenApiResponse( - response_cls=ApiResponseForDefault, -) -_status_code_to_response = { - 'default': _response_for_default, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _create_users_with_list_input_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,list, tuple, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseForDefault, - ]: ... - - @typing.overload - def _create_users_with_list_input_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,list, tuple, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseForDefault, - ]: ... - - - @typing.overload - def _create_users_with_list_input_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,list, tuple, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _create_users_with_list_input_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,list, tuple, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _create_users_with_list_input_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,list, tuple, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - Creates list of users with given input array - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_user.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class CreateUsersWithListInput(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def create_users_with_list_input( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,list, tuple, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseForDefault, - ]: ... - - @typing.overload - def create_users_with_list_input( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,list, tuple, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseForDefault, - ]: ... - - - @typing.overload - def create_users_with_list_input( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,list, tuple, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def create_users_with_list_input( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,list, tuple, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def create_users_with_list_input( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,list, tuple, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._create_users_with_list_input_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,list, tuple, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseForDefault, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,list, tuple, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseForDefault, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,list, tuple, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,list, tuple, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,list, tuple, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._create_users_with_list_input_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/user_create_with_list/post.pyi b/samples/openapi3/client/petstore/python/petstore_api/paths/user_create_with_list/post.pyi deleted file mode 100644 index ef9c94f6225..00000000000 --- a/samples/openapi3/client/petstore/python/petstore_api/paths/user_create_with_list/post.pyi +++ /dev/null @@ -1,323 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from petstore_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from petstore_api import schemas # noqa: F401 - -from petstore_api.model.user import User - -# body param - - -class SchemaForRequestBodyApplicationJson( - schemas.ListSchema -): - - - class MetaOapg: - - @staticmethod - def items() -> typing.Type['User']: - return User - - def __new__( - cls, - arg: typing.Union[typing.Tuple['User'], typing.List['User']], - _configuration: typing.Optional[schemas.Configuration] = None, - ) -> 'SchemaForRequestBodyApplicationJson': - return super().__new__( - cls, - arg, - _configuration=_configuration, - ) - - def __getitem__(self, i: int) -> 'User': - return super().__getitem__(i) - - -request_body_user = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseForDefault(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_default = api_client.OpenApiResponse( - response_cls=ApiResponseForDefault, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _create_users_with_list_input_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,list, tuple, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseForDefault, - ]: ... - - @typing.overload - def _create_users_with_list_input_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,list, tuple, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseForDefault, - ]: ... - - - @typing.overload - def _create_users_with_list_input_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,list, tuple, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _create_users_with_list_input_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,list, tuple, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _create_users_with_list_input_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,list, tuple, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - Creates list of users with given input array - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_user.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class CreateUsersWithListInput(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def create_users_with_list_input( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,list, tuple, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseForDefault, - ]: ... - - @typing.overload - def create_users_with_list_input( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,list, tuple, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseForDefault, - ]: ... - - - @typing.overload - def create_users_with_list_input( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,list, tuple, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def create_users_with_list_input( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,list, tuple, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def create_users_with_list_input( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,list, tuple, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._create_users_with_list_input_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,list, tuple, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseForDefault, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,list, tuple, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseForDefault, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,list, tuple, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,list, tuple, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,list, tuple, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._create_users_with_list_input_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/user_create_with_list/post/__init__.py b/samples/openapi3/client/petstore/python/petstore_api/paths/user_create_with_list/post/__init__.py new file mode 100644 index 00000000000..36bb233af20 --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/user_create_with_list/post/__init__.py @@ -0,0 +1,321 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from petstore_api.model.user import User + +from .. import path +from . import response_for_default + + + +class RequestBody: + class Schemas: + + + class application_json( + schemas.ListSchema + ): + + + class MetaOapg: + + @staticmethod + def items() -> typing.Type['User']: + return User + + def __new__( + cls, + arg: typing.Union[typing.Tuple['User'], typing.List['User']], + _configuration: typing.Optional[schemas.Configuration] = None, + ) -> 'application_json': + return super().__new__( + cls, + arg, + _configuration=_configuration, + ) + + def __getitem__(self, i: int) -> 'User': + return super().__getitem__(i) + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + +_status_code_to_response = { + 'default': response_for_default.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _create_users_with_list_input_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,list, tuple, ], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_default.ApiResponse, + ]: ... + + @typing.overload + def _create_users_with_list_input_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,list, tuple, ], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_default.ApiResponse, + ]: ... + + + @typing.overload + def _create_users_with_list_input_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,list, tuple, ], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _create_users_with_list_input_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,list, tuple, ], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_default.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _create_users_with_list_input_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,list, tuple, ], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + Creates list of users with given input array + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class CreateUsersWithListInput(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def create_users_with_list_input( + self, + body: typing.Union[RequestBody.Schemas.application_json,list, tuple, ], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_default.ApiResponse, + ]: ... + + @typing.overload + def create_users_with_list_input( + self, + body: typing.Union[RequestBody.Schemas.application_json,list, tuple, ], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_default.ApiResponse, + ]: ... + + + @typing.overload + def create_users_with_list_input( + self, + body: typing.Union[RequestBody.Schemas.application_json,list, tuple, ], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def create_users_with_list_input( + self, + body: typing.Union[RequestBody.Schemas.application_json,list, tuple, ], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_default.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def create_users_with_list_input( + self, + body: typing.Union[RequestBody.Schemas.application_json,list, tuple, ], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._create_users_with_list_input_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,list, tuple, ], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_default.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,list, tuple, ], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_default.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,list, tuple, ], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,list, tuple, ], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_default.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,list, tuple, ], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._create_users_with_list_input_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/user_create_with_list/post/__init__.pyi b/samples/openapi3/client/petstore/python/petstore_api/paths/user_create_with_list/post/__init__.pyi new file mode 100644 index 00000000000..a6850fde31a --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/user_create_with_list/post/__init__.pyi @@ -0,0 +1,316 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from petstore_api.model.user import User + +from . import response_for_default + + + +class RequestBody: + class Schemas: + + + class application_json( + schemas.ListSchema + ): + + + class MetaOapg: + + @staticmethod + def items() -> typing.Type['User']: + return User + + def __new__( + cls, + arg: typing.Union[typing.Tuple['User'], typing.List['User']], + _configuration: typing.Optional[schemas.Configuration] = None, + ) -> 'application_json': + return super().__new__( + cls, + arg, + _configuration=_configuration, + ) + + def __getitem__(self, i: int) -> 'User': + return super().__getitem__(i) + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + + +class BaseApi(api_client.Api): + @typing.overload + def _create_users_with_list_input_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,list, tuple, ], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_default.ApiResponse, + ]: ... + + @typing.overload + def _create_users_with_list_input_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,list, tuple, ], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_default.ApiResponse, + ]: ... + + + @typing.overload + def _create_users_with_list_input_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,list, tuple, ], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _create_users_with_list_input_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,list, tuple, ], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_default.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _create_users_with_list_input_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,list, tuple, ], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + Creates list of users with given input array + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='post'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class CreateUsersWithListInput(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def create_users_with_list_input( + self, + body: typing.Union[RequestBody.Schemas.application_json,list, tuple, ], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_default.ApiResponse, + ]: ... + + @typing.overload + def create_users_with_list_input( + self, + body: typing.Union[RequestBody.Schemas.application_json,list, tuple, ], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_default.ApiResponse, + ]: ... + + + @typing.overload + def create_users_with_list_input( + self, + body: typing.Union[RequestBody.Schemas.application_json,list, tuple, ], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def create_users_with_list_input( + self, + body: typing.Union[RequestBody.Schemas.application_json,list, tuple, ], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_default.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def create_users_with_list_input( + self, + body: typing.Union[RequestBody.Schemas.application_json,list, tuple, ], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._create_users_with_list_input_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForpost(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,list, tuple, ], + content_type: typing_extensions.Literal["application/json"] = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_default.ApiResponse, + ]: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,list, tuple, ], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_default.ApiResponse, + ]: ... + + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,list, tuple, ], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,list, tuple, ], + content_type: str = ..., + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_default.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def post( + self, + body: typing.Union[RequestBody.Schemas.application_json,list, tuple, ], + content_type: str = 'application/json', + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._create_users_with_list_input_oapg( + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/user_create_with_list/post/response_for_default.py b/samples/openapi3/client/petstore/python/petstore_api/paths/user_create_with_list/post/response_for_default.py new file mode 100644 index 00000000000..7ec95a8627a --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/user_create_with_list/post/response_for_default.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from petstore_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/user_login/get.py b/samples/openapi3/client/petstore/python/petstore_api/paths/user_login/get.py deleted file mode 100644 index 0d963a9eb28..00000000000 --- a/samples/openapi3/client/petstore/python/petstore_api/paths/user_login/get.py +++ /dev/null @@ -1,339 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from petstore_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from petstore_api import schemas # noqa: F401 - -from . import path - -# Query params -UsernameSchema = schemas.StrSchema -PasswordSchema = schemas.StrSchema -RequestRequiredQueryParams = typing_extensions.TypedDict( - 'RequestRequiredQueryParams', - { - 'username': typing.Union[UsernameSchema, str, ], - 'password': typing.Union[PasswordSchema, str, ], - } -) -RequestOptionalQueryParams = typing_extensions.TypedDict( - 'RequestOptionalQueryParams', - { - }, - total=False -) - - -class RequestQueryParams(RequestRequiredQueryParams, RequestOptionalQueryParams): - pass - - -request_query_username = api_client.QueryParameter( - name="username", - style=api_client.ParameterStyle.FORM, - schema=UsernameSchema, - required=True, - explode=True, -) -request_query_password = api_client.QueryParameter( - name="password", - style=api_client.ParameterStyle.FORM, - schema=PasswordSchema, - required=True, - explode=True, -) -XRateLimitSchema = schemas.Int32Schema -x_rate_limit_parameter = api_client.HeaderParameter( - name="X-Rate-Limit", - style=api_client.ParameterStyle.SIMPLE, - schema=XRateLimitSchema, -) -XExpiresAfterSchema = schemas.DateTimeSchema -x_expires_after_parameter = api_client.HeaderParameter( - name="X-Expires-After", - style=api_client.ParameterStyle.SIMPLE, - schema=XExpiresAfterSchema, -) -SchemaFor200ResponseBodyApplicationXml = schemas.StrSchema -SchemaFor200ResponseBodyApplicationJson = schemas.StrSchema -ResponseHeadersFor200 = typing_extensions.TypedDict( - 'ResponseHeadersFor200', - { - 'X-Rate-Limit': XRateLimitSchema, - 'X-Expires-After': XExpiresAfterSchema, - } -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationXml, - SchemaFor200ResponseBodyApplicationJson, - ] - headers: ResponseHeadersFor200 - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/xml': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationXml), - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, - headers=[ - x_rate_limit_parameter, - x_expires_after_parameter, - ] -) - - -@dataclass -class ApiResponseFor400(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_400 = api_client.OpenApiResponse( - response_cls=ApiResponseFor400, -) -_status_code_to_response = { - '200': _response_for_200, - '400': _response_for_400, -} -_all_accept_content_types = ( - 'application/xml', - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _login_user_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _login_user_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _login_user_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _login_user_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - Logs user into the system - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - self._verify_typed_dict_inputs_oapg(RequestQueryParams, query_params) - used_path = path.value - - prefix_separator_iterator = None - for parameter in ( - request_query_username, - request_query_password, - ): - parameter_data = query_params.get(parameter.name, schemas.unset) - if parameter_data is schemas.unset: - continue - if prefix_separator_iterator is None: - prefix_separator_iterator = parameter.get_prefix_separator_iterator() - serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) - for serialized_value in serialized_data.values(): - used_path += serialized_value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='get'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class LoginUser(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def login_user( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def login_user( - self, - skip_deserialization: typing_extensions.Literal[True], - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def login_user( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def login_user( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._login_user_oapg( - query_params=query_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForget(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def get( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def get( - self, - skip_deserialization: typing_extensions.Literal[True], - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._login_user_oapg( - query_params=query_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/user_login/get.pyi b/samples/openapi3/client/petstore/python/petstore_api/paths/user_login/get.pyi deleted file mode 100644 index 3fb920a0c0e..00000000000 --- a/samples/openapi3/client/petstore/python/petstore_api/paths/user_login/get.pyi +++ /dev/null @@ -1,323 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from petstore_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from petstore_api import schemas # noqa: F401 - -# Query params -UsernameSchema = schemas.StrSchema -PasswordSchema = schemas.StrSchema -RequestRequiredQueryParams = typing_extensions.TypedDict( - 'RequestRequiredQueryParams', - { - 'username': typing.Union[UsernameSchema, str, ], - 'password': typing.Union[PasswordSchema, str, ], - } -) -RequestOptionalQueryParams = typing_extensions.TypedDict( - 'RequestOptionalQueryParams', - { - }, - total=False -) - - -class RequestQueryParams(RequestRequiredQueryParams, RequestOptionalQueryParams): - pass - - -request_query_username = api_client.QueryParameter( - name="username", - style=api_client.ParameterStyle.FORM, - schema=UsernameSchema, - required=True, - explode=True, -) -request_query_password = api_client.QueryParameter( - name="password", - style=api_client.ParameterStyle.FORM, - schema=PasswordSchema, - required=True, - explode=True, -) -XRateLimitSchema = schemas.Int32Schema -XExpiresAfterSchema = schemas.DateTimeSchema -SchemaFor200ResponseBodyApplicationXml = schemas.StrSchema -SchemaFor200ResponseBodyApplicationJson = schemas.StrSchema -ResponseHeadersFor200 = typing_extensions.TypedDict( - 'ResponseHeadersFor200', - { - 'X-Rate-Limit': XRateLimitSchema, - 'X-Expires-After': XExpiresAfterSchema, - } -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationXml, - SchemaFor200ResponseBodyApplicationJson, - ] - headers: ResponseHeadersFor200 - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/xml': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationXml), - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, - headers=[ - x_rate_limit_parameter, - x_expires_after_parameter, - ] -) - - -@dataclass -class ApiResponseFor400(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_400 = api_client.OpenApiResponse( - response_cls=ApiResponseFor400, -) -_all_accept_content_types = ( - 'application/xml', - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _login_user_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _login_user_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _login_user_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _login_user_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - Logs user into the system - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - self._verify_typed_dict_inputs_oapg(RequestQueryParams, query_params) - used_path = path.value - - prefix_separator_iterator = None - for parameter in ( - request_query_username, - request_query_password, - ): - parameter_data = query_params.get(parameter.name, schemas.unset) - if parameter_data is schemas.unset: - continue - if prefix_separator_iterator is None: - prefix_separator_iterator = parameter.get_prefix_separator_iterator() - serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) - for serialized_value in serialized_data.values(): - used_path += serialized_value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='get'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class LoginUser(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def login_user( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def login_user( - self, - skip_deserialization: typing_extensions.Literal[True], - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def login_user( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def login_user( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._login_user_oapg( - query_params=query_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForget(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def get( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def get( - self, - skip_deserialization: typing_extensions.Literal[True], - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._login_user_oapg( - query_params=query_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/user_login/get/__init__.py b/samples/openapi3/client/petstore/python/petstore_api/paths/user_login/get/__init__.py new file mode 100644 index 00000000000..720acdca5aa --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/user_login/get/__init__.py @@ -0,0 +1,287 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 +from . import response_for_400 + + + +class RequestQueryParameters: + class Schemas: + username = schemas.StrSchema + password = schemas.StrSchema + + + RequiredParams = typing_extensions.TypedDict( + 'RequiredParams', + { + 'username': typing.Union[Schemas.username, str, ], + 'password': typing.Union[Schemas.password, str, ], + } + ) + OptionalParams = typing_extensions.TypedDict( + 'OptionalParams', + { + }, + total=False + ) + + + class Params(RequiredParams, OptionalParams): + pass + + + parameters = [ + api_client.QueryParameter( + name="username", + style=api_client.ParameterStyle.FORM, + schema=Schemas.username, + required=True, + explode=True, + ), + api_client.QueryParameter( + name="password", + style=api_client.ParameterStyle.FORM, + schema=Schemas.password, + required=True, + explode=True, + ), + ] +_status_code_to_response = { + '200': response_for_200.response, + '400': response_for_400.response, +} +_all_accept_content_types = ( + 'application/xml', + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _login_user_oapg( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _login_user_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _login_user_oapg( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _login_user_oapg( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + Logs user into the system + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + self._verify_typed_dict_inputs_oapg(RequestQueryParameters.Params, query_params) + used_path = path.value + + prefix_separator_iterator = None + for parameter in RequestQueryParameters.parameters: + parameter_data = query_params.get(parameter.name, schemas.unset) + if parameter_data is schemas.unset: + continue + if prefix_separator_iterator is None: + prefix_separator_iterator = parameter.get_prefix_separator_iterator() + serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) + for serialized_value in serialized_data.values(): + used_path += serialized_value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='get'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class LoginUser(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def login_user( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def login_user( + self, + skip_deserialization: typing_extensions.Literal[True], + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def login_user( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def login_user( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._login_user_oapg( + query_params=query_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForget(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def get( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def get( + self, + skip_deserialization: typing_extensions.Literal[True], + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def get( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def get( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._login_user_oapg( + query_params=query_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/user_login/get/__init__.pyi b/samples/openapi3/client/petstore/python/petstore_api/paths/user_login/get/__init__.pyi new file mode 100644 index 00000000000..7bcf78abb8c --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/user_login/get/__init__.pyi @@ -0,0 +1,281 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from . import response_for_200 +from . import response_for_400 + + + +class RequestQueryParameters: + class Schemas: + username = schemas.StrSchema + password = schemas.StrSchema + + + RequiredParams = typing_extensions.TypedDict( + 'RequiredParams', + { + 'username': typing.Union[Schemas.username, str, ], + 'password': typing.Union[Schemas.password, str, ], + } + ) + OptionalParams = typing_extensions.TypedDict( + 'OptionalParams', + { + }, + total=False + ) + + + class Params(RequiredParams, OptionalParams): + pass + + + parameters = [ + api_client.QueryParameter( + name="username", + style=api_client.ParameterStyle.FORM, + schema=Schemas.username, + required=True, + explode=True, + ), + api_client.QueryParameter( + name="password", + style=api_client.ParameterStyle.FORM, + schema=Schemas.password, + required=True, + explode=True, + ), + ]_all_accept_content_types = ( + 'application/xml', + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _login_user_oapg( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _login_user_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _login_user_oapg( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _login_user_oapg( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + Logs user into the system + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + self._verify_typed_dict_inputs_oapg(RequestQueryParameters.Params, query_params) + used_path = path.value + + prefix_separator_iterator = None + for parameter in RequestQueryParameters.parameters: + parameter_data = query_params.get(parameter.name, schemas.unset) + if parameter_data is schemas.unset: + continue + if prefix_separator_iterator is None: + prefix_separator_iterator = parameter.get_prefix_separator_iterator() + serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) + for serialized_value in serialized_data.values(): + used_path += serialized_value + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='get'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class LoginUser(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def login_user( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def login_user( + self, + skip_deserialization: typing_extensions.Literal[True], + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def login_user( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def login_user( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._login_user_oapg( + query_params=query_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForget(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def get( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def get( + self, + skip_deserialization: typing_extensions.Literal[True], + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def get( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def get( + self, + query_params: RequestQueryParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._login_user_oapg( + query_params=query_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/user_login/get/response_for_200.py b/samples/openapi3/client/petstore/python/petstore_api/paths/user_login/get/response_for_200.py new file mode 100644 index 00000000000..7adff45441c --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/user_login/get/response_for_200.py @@ -0,0 +1,85 @@ +import dataclasses +import urllib3 + +from petstore_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + + +class Header: + class Schemas: + x_rate_limit = schemas.Int32Schema + x_expires_after = schemas.DateTimeSchema + + + RequiredParams = typing_extensions.TypedDict( + 'RequiredParams', + { + } + ) + OptionalParams = typing_extensions.TypedDict( + 'OptionalParams', + { + 'X-Rate-Limit': typing.Union[Schemas.x_rate_limit, decimal.Decimal, int, ], + 'X-Expires-After': typing.Union[Schemas.x_expires_after, str, datetime, ], + }, + total=False + ) + + + class Params(RequiredParams, OptionalParams): + pass + + + parameters = [ + api_client.HeaderParameter( + name="X-Rate-Limit", + style=api_client.ParameterStyle.SIMPLE, + schema=Schemas.x_rate_limit, + ), + api_client.HeaderParameter( + name="X-Expires-After", + style=api_client.ParameterStyle.SIMPLE, + schema=Schemas.x_expires_after, + ), + ] + +class BodySchemas: + # body schemas + application_xml = schemas.StrSchema + application_json = schemas.StrSchema + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_xml, + BodySchemas.application_json, + ] + headers: Header.Params + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/xml': api_client.MediaType( + schema=BodySchemas.application_xml, + ), + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, + headers=Header.parameters +) diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/user_login/get/response_for_400.py b/samples/openapi3/client/petstore/python/petstore_api/paths/user_login/get/response_for_400.py new file mode 100644 index 00000000000..7ec95a8627a --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/user_login/get/response_for_400.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from petstore_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/user_logout/get.py b/samples/openapi3/client/petstore/python/petstore_api/paths/user_logout/get.py deleted file mode 100644 index 0814ac97f9f..00000000000 --- a/samples/openapi3/client/petstore/python/petstore_api/paths/user_logout/get.py +++ /dev/null @@ -1,206 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 - -from petstore_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from petstore_api import schemas # noqa: F401 - -from . import path - - - -@dataclass -class ApiResponseForDefault(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_default = api_client.OpenApiResponse( - response_cls=ApiResponseForDefault, -) -_status_code_to_response = { - 'default': _response_for_default, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _logout_user_oapg( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseForDefault, - ]: ... - - @typing.overload - def _logout_user_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _logout_user_oapg( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _logout_user_oapg( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - Logs out current logged in user session - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - # TODO add cookie handling - - response = self.api_client.call_api( - resource_path=used_path, - method='get'.upper(), - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class LogoutUser(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def logout_user( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseForDefault, - ]: ... - - @typing.overload - def logout_user( - self, - skip_deserialization: typing_extensions.Literal[True], - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def logout_user( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def logout_user( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._logout_user_oapg( - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForget(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def get( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseForDefault, - ]: ... - - @typing.overload - def get( - self, - skip_deserialization: typing_extensions.Literal[True], - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._logout_user_oapg( - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/user_logout/get.pyi b/samples/openapi3/client/petstore/python/petstore_api/paths/user_logout/get.pyi deleted file mode 100644 index 302df64884f..00000000000 --- a/samples/openapi3/client/petstore/python/petstore_api/paths/user_logout/get.pyi +++ /dev/null @@ -1,201 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 - -from petstore_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from petstore_api import schemas # noqa: F401 - - - -@dataclass -class ApiResponseForDefault(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_default = api_client.OpenApiResponse( - response_cls=ApiResponseForDefault, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _logout_user_oapg( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseForDefault, - ]: ... - - @typing.overload - def _logout_user_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _logout_user_oapg( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _logout_user_oapg( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - Logs out current logged in user session - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - used_path = path.value - # TODO add cookie handling - - response = self.api_client.call_api( - resource_path=used_path, - method='get'.upper(), - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class LogoutUser(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def logout_user( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseForDefault, - ]: ... - - @typing.overload - def logout_user( - self, - skip_deserialization: typing_extensions.Literal[True], - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def logout_user( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def logout_user( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._logout_user_oapg( - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForget(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def get( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseForDefault, - ]: ... - - @typing.overload - def get( - self, - skip_deserialization: typing_extensions.Literal[True], - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._logout_user_oapg( - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/user_logout/get/__init__.py b/samples/openapi3/client/petstore/python/petstore_api/paths/user_logout/get/__init__.py new file mode 100644 index 00000000000..c3871dd3ee7 --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/user_logout/get/__init__.py @@ -0,0 +1,196 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from .. import path +from . import response_for_default + + +_status_code_to_response = { + 'default': response_for_default.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _logout_user_oapg( + self, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_default.ApiResponse, + ]: ... + + @typing.overload + def _logout_user_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _logout_user_oapg( + self, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_default.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _logout_user_oapg( + self, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + Logs out current logged in user session + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + # TODO add cookie handling + + response = self.api_client.call_api( + resource_path=used_path, + method='get'.upper(), + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class LogoutUser(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def logout_user( + self, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_default.ApiResponse, + ]: ... + + @typing.overload + def logout_user( + self, + skip_deserialization: typing_extensions.Literal[True], + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def logout_user( + self, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_default.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def logout_user( + self, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._logout_user_oapg( + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForget(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def get( + self, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_default.ApiResponse, + ]: ... + + @typing.overload + def get( + self, + skip_deserialization: typing_extensions.Literal[True], + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def get( + self, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_default.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def get( + self, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._logout_user_oapg( + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/user_logout/get/__init__.pyi b/samples/openapi3/client/petstore/python/petstore_api/paths/user_logout/get/__init__.pyi new file mode 100644 index 00000000000..00868ebe200 --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/user_logout/get/__init__.pyi @@ -0,0 +1,191 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from . import response_for_default + + + +class BaseApi(api_client.Api): + @typing.overload + def _logout_user_oapg( + self, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_default.ApiResponse, + ]: ... + + @typing.overload + def _logout_user_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _logout_user_oapg( + self, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_default.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _logout_user_oapg( + self, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + Logs out current logged in user session + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + used_path = path.value + # TODO add cookie handling + + response = self.api_client.call_api( + resource_path=used_path, + method='get'.upper(), + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class LogoutUser(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def logout_user( + self, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_default.ApiResponse, + ]: ... + + @typing.overload + def logout_user( + self, + skip_deserialization: typing_extensions.Literal[True], + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def logout_user( + self, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_default.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def logout_user( + self, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._logout_user_oapg( + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForget(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def get( + self, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_default.ApiResponse, + ]: ... + + @typing.overload + def get( + self, + skip_deserialization: typing_extensions.Literal[True], + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def get( + self, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_default.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def get( + self, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._logout_user_oapg( + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/user_logout/get/response_for_default.py b/samples/openapi3/client/petstore/python/petstore_api/paths/user_logout/get/response_for_default.py new file mode 100644 index 00000000000..7ec95a8627a --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/user_logout/get/response_for_default.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from petstore_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/user_username/delete.py b/samples/openapi3/client/petstore/python/petstore_api/paths/user_username/delete.py deleted file mode 100644 index 769252ca8da..00000000000 --- a/samples/openapi3/client/petstore/python/petstore_api/paths/user_username/delete.py +++ /dev/null @@ -1,269 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 - -from petstore_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from petstore_api import schemas # noqa: F401 - -from . import path - -# Path params -UsernameSchema = schemas.StrSchema -RequestRequiredPathParams = typing_extensions.TypedDict( - 'RequestRequiredPathParams', - { - 'username': typing.Union[UsernameSchema, str, ], - } -) -RequestOptionalPathParams = typing_extensions.TypedDict( - 'RequestOptionalPathParams', - { - }, - total=False -) - - -class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): - pass - - -request_path_username = api_client.PathParameter( - name="username", - style=api_client.ParameterStyle.SIMPLE, - schema=UsernameSchema, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -@dataclass -class ApiResponseFor404(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_404 = api_client.OpenApiResponse( - response_cls=ApiResponseFor404, -) -_status_code_to_response = { - '200': _response_for_200, - '404': _response_for_404, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _delete_user_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _delete_user_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _delete_user_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _delete_user_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - Delete user - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) - used_path = path.value - - _path_params = {} - for parameter in ( - request_path_username, - ): - parameter_data = path_params.get(parameter.name, schemas.unset) - if parameter_data is schemas.unset: - continue - serialized_data = parameter.serialize(parameter_data) - _path_params.update(serialized_data) - - for k, v in _path_params.items(): - used_path = used_path.replace('{%s}' % k, v) - # TODO add cookie handling - - response = self.api_client.call_api( - resource_path=used_path, - method='delete'.upper(), - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class DeleteUser(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def delete_user( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def delete_user( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def delete_user( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def delete_user( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._delete_user_oapg( - path_params=path_params, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiFordelete(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def delete( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def delete( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def delete( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def delete( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._delete_user_oapg( - path_params=path_params, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/user_username/delete.pyi b/samples/openapi3/client/petstore/python/petstore_api/paths/user_username/delete.pyi deleted file mode 100644 index 3240953717f..00000000000 --- a/samples/openapi3/client/petstore/python/petstore_api/paths/user_username/delete.pyi +++ /dev/null @@ -1,263 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 - -from petstore_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from petstore_api import schemas # noqa: F401 - -# Path params -UsernameSchema = schemas.StrSchema -RequestRequiredPathParams = typing_extensions.TypedDict( - 'RequestRequiredPathParams', - { - 'username': typing.Union[UsernameSchema, str, ], - } -) -RequestOptionalPathParams = typing_extensions.TypedDict( - 'RequestOptionalPathParams', - { - }, - total=False -) - - -class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): - pass - - -request_path_username = api_client.PathParameter( - name="username", - style=api_client.ParameterStyle.SIMPLE, - schema=UsernameSchema, - required=True, -) - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -@dataclass -class ApiResponseFor404(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_404 = api_client.OpenApiResponse( - response_cls=ApiResponseFor404, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _delete_user_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _delete_user_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _delete_user_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _delete_user_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - Delete user - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) - used_path = path.value - - _path_params = {} - for parameter in ( - request_path_username, - ): - parameter_data = path_params.get(parameter.name, schemas.unset) - if parameter_data is schemas.unset: - continue - serialized_data = parameter.serialize(parameter_data) - _path_params.update(serialized_data) - - for k, v in _path_params.items(): - used_path = used_path.replace('{%s}' % k, v) - # TODO add cookie handling - - response = self.api_client.call_api( - resource_path=used_path, - method='delete'.upper(), - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class DeleteUser(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def delete_user( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def delete_user( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def delete_user( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def delete_user( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._delete_user_oapg( - path_params=path_params, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiFordelete(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def delete( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def delete( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def delete( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def delete( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._delete_user_oapg( - path_params=path_params, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/user_username/delete/__init__.py b/samples/openapi3/client/petstore/python/petstore_api/paths/user_username/delete/__init__.py new file mode 100644 index 00000000000..fda577bc54e --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/user_username/delete/__init__.py @@ -0,0 +1,252 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 +from . import response_for_404 + + + +class RequestPathParameters: + class Schemas: + username = schemas.StrSchema + + + RequiredParams = typing_extensions.TypedDict( + 'RequiredParams', + { + 'username': typing.Union[Schemas.username, str, ], + } + ) + OptionalParams = typing_extensions.TypedDict( + 'OptionalParams', + { + }, + total=False + ) + + + class Params(RequiredParams, OptionalParams): + pass + + + parameters = [ + api_client.PathParameter( + name="username", + style=api_client.ParameterStyle.SIMPLE, + schema=Schemas.username, + required=True, + ), + ] +_status_code_to_response = { + '200': response_for_200.response, + '404': response_for_404.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _delete_user_oapg( + self, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _delete_user_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _delete_user_oapg( + self, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _delete_user_oapg( + self, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + Delete user + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + self._verify_typed_dict_inputs_oapg(RequestPathParameters.Params, path_params) + used_path = path.value + + _path_params = {} + for parameter in RequestPathParameters.parameters: + parameter_data = path_params.get(parameter.name, schemas.unset) + if parameter_data is schemas.unset: + continue + serialized_data = parameter.serialize(parameter_data) + _path_params.update(serialized_data) + + for k, v in _path_params.items(): + used_path = used_path.replace('{%s}' % k, v) + # TODO add cookie handling + + response = self.api_client.call_api( + resource_path=used_path, + method='delete'.upper(), + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class DeleteUser(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def delete_user( + self, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def delete_user( + self, + skip_deserialization: typing_extensions.Literal[True], + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def delete_user( + self, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def delete_user( + self, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._delete_user_oapg( + path_params=path_params, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiFordelete(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def delete( + self, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def delete( + self, + skip_deserialization: typing_extensions.Literal[True], + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def delete( + self, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def delete( + self, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._delete_user_oapg( + path_params=path_params, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/user_username/delete/__init__.pyi b/samples/openapi3/client/petstore/python/petstore_api/paths/user_username/delete/__init__.pyi new file mode 100644 index 00000000000..bc2c0644c36 --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/user_username/delete/__init__.pyi @@ -0,0 +1,246 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from . import response_for_200 +from . import response_for_404 + + + +class RequestPathParameters: + class Schemas: + username = schemas.StrSchema + + + RequiredParams = typing_extensions.TypedDict( + 'RequiredParams', + { + 'username': typing.Union[Schemas.username, str, ], + } + ) + OptionalParams = typing_extensions.TypedDict( + 'OptionalParams', + { + }, + total=False + ) + + + class Params(RequiredParams, OptionalParams): + pass + + + parameters = [ + api_client.PathParameter( + name="username", + style=api_client.ParameterStyle.SIMPLE, + schema=Schemas.username, + required=True, + ), + ] + +class BaseApi(api_client.Api): + @typing.overload + def _delete_user_oapg( + self, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _delete_user_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _delete_user_oapg( + self, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _delete_user_oapg( + self, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + Delete user + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + self._verify_typed_dict_inputs_oapg(RequestPathParameters.Params, path_params) + used_path = path.value + + _path_params = {} + for parameter in RequestPathParameters.parameters: + parameter_data = path_params.get(parameter.name, schemas.unset) + if parameter_data is schemas.unset: + continue + serialized_data = parameter.serialize(parameter_data) + _path_params.update(serialized_data) + + for k, v in _path_params.items(): + used_path = used_path.replace('{%s}' % k, v) + # TODO add cookie handling + + response = self.api_client.call_api( + resource_path=used_path, + method='delete'.upper(), + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class DeleteUser(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def delete_user( + self, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def delete_user( + self, + skip_deserialization: typing_extensions.Literal[True], + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def delete_user( + self, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def delete_user( + self, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._delete_user_oapg( + path_params=path_params, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiFordelete(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def delete( + self, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def delete( + self, + skip_deserialization: typing_extensions.Literal[True], + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def delete( + self, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def delete( + self, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._delete_user_oapg( + path_params=path_params, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/user_username/delete/response_for_200.py b/samples/openapi3/client/petstore/python/petstore_api/paths/user_username/delete/response_for_200.py new file mode 100644 index 00000000000..7ec95a8627a --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/user_username/delete/response_for_200.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from petstore_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/user_username/delete/response_for_404.py b/samples/openapi3/client/petstore/python/petstore_api/paths/user_username/delete/response_for_404.py new file mode 100644 index 00000000000..7ec95a8627a --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/user_username/delete/response_for_404.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from petstore_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/user_username/get.py b/samples/openapi3/client/petstore/python/petstore_api/paths/user_username/get.py deleted file mode 100644 index 9ee437ce793..00000000000 --- a/samples/openapi3/client/petstore/python/petstore_api/paths/user_username/get.py +++ /dev/null @@ -1,320 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from petstore_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from petstore_api import schemas # noqa: F401 - -from petstore_api.model.user import User - -from . import path - -# Path params -UsernameSchema = schemas.StrSchema -RequestRequiredPathParams = typing_extensions.TypedDict( - 'RequestRequiredPathParams', - { - 'username': typing.Union[UsernameSchema, str, ], - } -) -RequestOptionalPathParams = typing_extensions.TypedDict( - 'RequestOptionalPathParams', - { - }, - total=False -) - - -class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): - pass - - -request_path_username = api_client.PathParameter( - name="username", - style=api_client.ParameterStyle.SIMPLE, - schema=UsernameSchema, - required=True, -) -SchemaFor200ResponseBodyApplicationXml = User -SchemaFor200ResponseBodyApplicationJson = User - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationXml, - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/xml': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationXml), - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) - - -@dataclass -class ApiResponseFor400(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_400 = api_client.OpenApiResponse( - response_cls=ApiResponseFor400, -) - - -@dataclass -class ApiResponseFor404(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_404 = api_client.OpenApiResponse( - response_cls=ApiResponseFor404, -) -_status_code_to_response = { - '200': _response_for_200, - '400': _response_for_400, - '404': _response_for_404, -} -_all_accept_content_types = ( - 'application/xml', - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _get_user_by_name_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _get_user_by_name_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _get_user_by_name_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _get_user_by_name_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - Get user by user name - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) - used_path = path.value - - _path_params = {} - for parameter in ( - request_path_username, - ): - parameter_data = path_params.get(parameter.name, schemas.unset) - if parameter_data is schemas.unset: - continue - serialized_data = parameter.serialize(parameter_data) - _path_params.update(serialized_data) - - for k, v in _path_params.items(): - used_path = used_path.replace('{%s}' % k, v) - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='get'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class GetUserByName(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def get_user_by_name( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def get_user_by_name( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_user_by_name( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_user_by_name( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_user_by_name_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForget(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def get( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def get( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_user_by_name_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/user_username/get.pyi b/samples/openapi3/client/petstore/python/petstore_api/paths/user_username/get.pyi deleted file mode 100644 index 63e188e6ce6..00000000000 --- a/samples/openapi3/client/petstore/python/petstore_api/paths/user_username/get.pyi +++ /dev/null @@ -1,313 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from petstore_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from petstore_api import schemas # noqa: F401 - -from petstore_api.model.user import User - -# Path params -UsernameSchema = schemas.StrSchema -RequestRequiredPathParams = typing_extensions.TypedDict( - 'RequestRequiredPathParams', - { - 'username': typing.Union[UsernameSchema, str, ], - } -) -RequestOptionalPathParams = typing_extensions.TypedDict( - 'RequestOptionalPathParams', - { - }, - total=False -) - - -class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): - pass - - -request_path_username = api_client.PathParameter( - name="username", - style=api_client.ParameterStyle.SIMPLE, - schema=UsernameSchema, - required=True, -) -SchemaFor200ResponseBodyApplicationXml = User -SchemaFor200ResponseBodyApplicationJson = User - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationXml, - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/xml': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationXml), - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) - - -@dataclass -class ApiResponseFor400(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_400 = api_client.OpenApiResponse( - response_cls=ApiResponseFor400, -) - - -@dataclass -class ApiResponseFor404(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_404 = api_client.OpenApiResponse( - response_cls=ApiResponseFor404, -) -_all_accept_content_types = ( - 'application/xml', - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _get_user_by_name_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _get_user_by_name_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _get_user_by_name_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _get_user_by_name_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - Get user by user name - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) - used_path = path.value - - _path_params = {} - for parameter in ( - request_path_username, - ): - parameter_data = path_params.get(parameter.name, schemas.unset) - if parameter_data is schemas.unset: - continue - serialized_data = parameter.serialize(parameter_data) - _path_params.update(serialized_data) - - for k, v in _path_params.items(): - used_path = used_path.replace('{%s}' % k, v) - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='get'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class GetUserByName(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def get_user_by_name( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def get_user_by_name( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_user_by_name( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_user_by_name( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_user_by_name_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForget(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def get( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def get( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_user_by_name_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/user_username/get/__init__.py b/samples/openapi3/client/petstore/python/petstore_api/paths/user_username/get/__init__.py new file mode 100644 index 00000000000..0e25b8c2ff7 --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/user_username/get/__init__.py @@ -0,0 +1,279 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from .. import path +from . import response_for_200 +from . import response_for_400 +from . import response_for_404 + + + +class RequestPathParameters: + class Schemas: + username = schemas.StrSchema + + + RequiredParams = typing_extensions.TypedDict( + 'RequiredParams', + { + 'username': typing.Union[Schemas.username, str, ], + } + ) + OptionalParams = typing_extensions.TypedDict( + 'OptionalParams', + { + }, + total=False + ) + + + class Params(RequiredParams, OptionalParams): + pass + + + parameters = [ + api_client.PathParameter( + name="username", + style=api_client.ParameterStyle.SIMPLE, + schema=Schemas.username, + required=True, + ), + ] +_status_code_to_response = { + '200': response_for_200.response, + '400': response_for_400.response, + '404': response_for_404.response, +} +_all_accept_content_types = ( + 'application/xml', + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _get_user_by_name_oapg( + self, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _get_user_by_name_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _get_user_by_name_oapg( + self, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _get_user_by_name_oapg( + self, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + Get user by user name + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + self._verify_typed_dict_inputs_oapg(RequestPathParameters.Params, path_params) + used_path = path.value + + _path_params = {} + for parameter in RequestPathParameters.parameters: + parameter_data = path_params.get(parameter.name, schemas.unset) + if parameter_data is schemas.unset: + continue + serialized_data = parameter.serialize(parameter_data) + _path_params.update(serialized_data) + + for k, v in _path_params.items(): + used_path = used_path.replace('{%s}' % k, v) + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='get'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class GetUserByName(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def get_user_by_name( + self, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def get_user_by_name( + self, + skip_deserialization: typing_extensions.Literal[True], + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def get_user_by_name( + self, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def get_user_by_name( + self, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._get_user_by_name_oapg( + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForget(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def get( + self, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def get( + self, + skip_deserialization: typing_extensions.Literal[True], + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def get( + self, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def get( + self, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._get_user_by_name_oapg( + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/user_username/get/__init__.pyi b/samples/openapi3/client/petstore/python/petstore_api/paths/user_username/get/__init__.pyi new file mode 100644 index 00000000000..f982869ce5e --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/user_username/get/__init__.pyi @@ -0,0 +1,272 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from . import response_for_200 +from . import response_for_400 +from . import response_for_404 + + + +class RequestPathParameters: + class Schemas: + username = schemas.StrSchema + + + RequiredParams = typing_extensions.TypedDict( + 'RequiredParams', + { + 'username': typing.Union[Schemas.username, str, ], + } + ) + OptionalParams = typing_extensions.TypedDict( + 'OptionalParams', + { + }, + total=False + ) + + + class Params(RequiredParams, OptionalParams): + pass + + + parameters = [ + api_client.PathParameter( + name="username", + style=api_client.ParameterStyle.SIMPLE, + schema=Schemas.username, + required=True, + ), + ]_all_accept_content_types = ( + 'application/xml', + 'application/json', +) + + +class BaseApi(api_client.Api): + @typing.overload + def _get_user_by_name_oapg( + self, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def _get_user_by_name_oapg( + self, + skip_deserialization: typing_extensions.Literal[True], + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _get_user_by_name_oapg( + self, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _get_user_by_name_oapg( + self, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + Get user by user name + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + self._verify_typed_dict_inputs_oapg(RequestPathParameters.Params, path_params) + used_path = path.value + + _path_params = {} + for parameter in RequestPathParameters.parameters: + parameter_data = path_params.get(parameter.name, schemas.unset) + if parameter_data is schemas.unset: + continue + serialized_data = parameter.serialize(parameter_data) + _path_params.update(serialized_data) + + for k, v in _path_params.items(): + used_path = used_path.replace('{%s}' % k, v) + + _headers = HTTPHeaderDict() + # TODO add cookie handling + if accept_content_types: + for accept_content_type in accept_content_types: + _headers.add('Accept', accept_content_type) + + response = self.api_client.call_api( + resource_path=used_path, + method='get'.upper(), + headers=_headers, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class GetUserByName(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def get_user_by_name( + self, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def get_user_by_name( + self, + skip_deserialization: typing_extensions.Literal[True], + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def get_user_by_name( + self, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def get_user_by_name( + self, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._get_user_by_name_oapg( + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForget(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def get( + self, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + ]: ... + + @typing.overload + def get( + self, + skip_deserialization: typing_extensions.Literal[True], + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def get( + self, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + response_for_200.ApiResponse, + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def get( + self, + path_params: RequestPathParameters.Params = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = _all_accept_content_types, + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._get_user_by_name_oapg( + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/user_username/get/response_for_200.py b/samples/openapi3/client/petstore/python/petstore_api/paths/user_username/get/response_for_200.py new file mode 100644 index 00000000000..dfa7a123c31 --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/user_username/get/response_for_200.py @@ -0,0 +1,48 @@ +import dataclasses +import urllib3 + +from petstore_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from petstore_api.model.user import User + + +class BodySchemas: + # body schemas + application_xml = User + application_json = User + pass + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: typing.Union[ + BodySchemas.application_xml, + BodySchemas.application_json, + ] + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, + content={ + 'application/xml': api_client.MediaType( + schema=BodySchemas.application_xml, + ), + 'application/json': api_client.MediaType( + schema=BodySchemas.application_json, + ), + }, +) diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/user_username/get/response_for_400.py b/samples/openapi3/client/petstore/python/petstore_api/paths/user_username/get/response_for_400.py new file mode 100644 index 00000000000..7ec95a8627a --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/user_username/get/response_for_400.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from petstore_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/user_username/get/response_for_404.py b/samples/openapi3/client/petstore/python/petstore_api/paths/user_username/get/response_for_404.py new file mode 100644 index 00000000000..7ec95a8627a --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/user_username/get/response_for_404.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from petstore_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/user_username/put.py b/samples/openapi3/client/petstore/python/petstore_api/paths/user_username/put.py deleted file mode 100644 index 5a5445aff92..00000000000 --- a/samples/openapi3/client/petstore/python/petstore_api/paths/user_username/put.py +++ /dev/null @@ -1,348 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from petstore_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from petstore_api import schemas # noqa: F401 - -from petstore_api.model.user import User - -from . import path - -# Path params -UsernameSchema = schemas.StrSchema -RequestRequiredPathParams = typing_extensions.TypedDict( - 'RequestRequiredPathParams', - { - 'username': typing.Union[UsernameSchema, str, ], - } -) -RequestOptionalPathParams = typing_extensions.TypedDict( - 'RequestOptionalPathParams', - { - }, - total=False -) - - -class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): - pass - - -request_path_username = api_client.PathParameter( - name="username", - style=api_client.ParameterStyle.SIMPLE, - schema=UsernameSchema, - required=True, -) -# body param -SchemaForRequestBodyApplicationJson = User - - -request_body_user = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor400(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_400 = api_client.OpenApiResponse( - response_cls=ApiResponseFor400, -) - - -@dataclass -class ApiResponseFor404(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_404 = api_client.OpenApiResponse( - response_cls=ApiResponseFor404, -) -_status_code_to_response = { - '400': _response_for_400, - '404': _response_for_404, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _update_user_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def _update_user_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _update_user_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _update_user_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _update_user_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - Updated user - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) - used_path = path.value - - _path_params = {} - for parameter in ( - request_path_username, - ): - parameter_data = path_params.get(parameter.name, schemas.unset) - if parameter_data is schemas.unset: - continue - serialized_data = parameter.serialize(parameter_data) - _path_params.update(serialized_data) - - for k, v in _path_params.items(): - used_path = used_path.replace('{%s}' % k, v) - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_user.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='put'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class UpdateUser(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def update_user( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def update_user( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def update_user( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def update_user( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def update_user( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._update_user_oapg( - body=body, - path_params=path_params, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForput(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._update_user_oapg( - body=body, - path_params=path_params, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/user_username/put.pyi b/samples/openapi3/client/petstore/python/petstore_api/paths/user_username/put.pyi deleted file mode 100644 index 864e5bfac32..00000000000 --- a/samples/openapi3/client/petstore/python/petstore_api/paths/user_username/put.pyi +++ /dev/null @@ -1,342 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from petstore_api import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from petstore_api import schemas # noqa: F401 - -from petstore_api.model.user import User - -# Path params -UsernameSchema = schemas.StrSchema -RequestRequiredPathParams = typing_extensions.TypedDict( - 'RequestRequiredPathParams', - { - 'username': typing.Union[UsernameSchema, str, ], - } -) -RequestOptionalPathParams = typing_extensions.TypedDict( - 'RequestOptionalPathParams', - { - }, - total=False -) - - -class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): - pass - - -request_path_username = api_client.PathParameter( - name="username", - style=api_client.ParameterStyle.SIMPLE, - schema=UsernameSchema, - required=True, -) -# body param -SchemaForRequestBodyApplicationJson = User - - -request_body_user = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor400(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_400 = api_client.OpenApiResponse( - response_cls=ApiResponseFor400, -) - - -@dataclass -class ApiResponseFor404(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_404 = api_client.OpenApiResponse( - response_cls=ApiResponseFor404, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _update_user_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def _update_user_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _update_user_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _update_user_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _update_user_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - Updated user - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances - """ - self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) - used_path = path.value - - _path_params = {} - for parameter in ( - request_path_username, - ): - parameter_data = path_params.get(parameter.name, schemas.unset) - if parameter_data is schemas.unset: - continue - serialized_data = parameter.serialize(parameter_data) - _path_params.update(serialized_data) - - for k, v in _path_params.items(): - used_path = used_path.replace('{%s}' % k, v) - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_user.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='put'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class UpdateUser(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def update_user( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def update_user( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def update_user( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def update_user( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def update_user( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._update_user_oapg( - body=body, - path_params=path_params, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForput(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._update_user_oapg( - body=body, - path_params=path_params, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/user_username/put/__init__.py b/samples/openapi3/client/petstore/python/petstore_api/paths/user_username/put/__init__.py new file mode 100644 index 00000000000..9be3b653934 --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/user_username/put/__init__.py @@ -0,0 +1,334 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from petstore_api.model.user import User + +from .. import path +from . import response_for_400 +from . import response_for_404 + + + +class RequestPathParameters: + class Schemas: + username = schemas.StrSchema + + + RequiredParams = typing_extensions.TypedDict( + 'RequiredParams', + { + 'username': typing.Union[Schemas.username, str, ], + } + ) + OptionalParams = typing_extensions.TypedDict( + 'OptionalParams', + { + }, + total=False + ) + + + class Params(RequiredParams, OptionalParams): + pass + + + parameters = [ + api_client.PathParameter( + name="username", + style=api_client.ParameterStyle.SIMPLE, + schema=Schemas.username, + required=True, + ), + ] + +class RequestBody: + class Schemas: + application_json = User + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + +_status_code_to_response = { + '400': response_for_400.response, + '404': response_for_404.response, +} + + +class BaseApi(api_client.Api): + @typing.overload + def _update_user_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> api_client.ApiResponseWithoutDeserialization: ... + @typing.overload + def _update_user_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _update_user_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _update_user_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _update_user_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + Updated user + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + self._verify_typed_dict_inputs_oapg(RequestPathParameters.Params, path_params) + used_path = path.value + + _path_params = {} + for parameter in RequestPathParameters.parameters: + parameter_data = path_params.get(parameter.name, schemas.unset) + if parameter_data is schemas.unset: + continue + serialized_data = parameter.serialize(parameter_data) + _path_params.update(serialized_data) + + for k, v in _path_params.items(): + used_path = used_path.replace('{%s}' % k, v) + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='put'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class UpdateUser(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def update_user( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> api_client.ApiResponseWithoutDeserialization: ... + @typing.overload + def update_user( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def update_user( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def update_user( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def update_user( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._update_user_oapg( + body=body, + path_params=path_params, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForput(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def put( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> api_client.ApiResponseWithoutDeserialization: ... + @typing.overload + def put( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def put( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def put( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def put( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._update_user_oapg( + body=body, + path_params=path_params, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/user_username/put/__init__.pyi b/samples/openapi3/client/petstore/python/petstore_api/paths/user_username/put/__init__.pyi new file mode 100644 index 00000000000..0d42a4b931e --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/user_username/put/__init__.pyi @@ -0,0 +1,328 @@ +# coding: utf-8 + +""" + + + Generated by: https://openapi-generator.tech +""" + +from dataclasses import dataclass +import typing_extensions +import urllib3 +from urllib3._collections import HTTPHeaderDict + +from petstore_api import api_client, exceptions +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + +from petstore_api.model.user import User + +from . import response_for_400 +from . import response_for_404 + + + +class RequestPathParameters: + class Schemas: + username = schemas.StrSchema + + + RequiredParams = typing_extensions.TypedDict( + 'RequiredParams', + { + 'username': typing.Union[Schemas.username, str, ], + } + ) + OptionalParams = typing_extensions.TypedDict( + 'OptionalParams', + { + }, + total=False + ) + + + class Params(RequiredParams, OptionalParams): + pass + + + parameters = [ + api_client.PathParameter( + name="username", + style=api_client.ParameterStyle.SIMPLE, + schema=Schemas.username, + required=True, + ), + ] + +class RequestBody: + class Schemas: + application_json = User + + parameter = api_client.RequestBody( + content={ + 'application/json': api_client.MediaType( + schema=Schemas.application_json + ), + }, + required=True, + ) + + +class BaseApi(api_client.Api): + @typing.overload + def _update_user_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> api_client.ApiResponseWithoutDeserialization: ... + @typing.overload + def _update_user_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _update_user_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def _update_user_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def _update_user_oapg( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + """ + Updated user + :param skip_deserialization: If true then api_response.response will be set but + api_response.body and api_response.headers will not be deserialized into schema + class instances + """ + self._verify_typed_dict_inputs_oapg(RequestPathParameters.Params, path_params) + used_path = path.value + + _path_params = {} + for parameter in RequestPathParameters.parameters: + parameter_data = path_params.get(parameter.name, schemas.unset) + if parameter_data is schemas.unset: + continue + serialized_data = parameter.serialize(parameter_data) + _path_params.update(serialized_data) + + for k, v in _path_params.items(): + used_path = used_path.replace('{%s}' % k, v) + + _headers = HTTPHeaderDict() + # TODO add cookie handling + + if body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + serialized_data = RequestBody.parameter.serialize(body, content_type) + _headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + response = self.api_client.call_api( + resource_path=used_path, + method='put'.upper(), + headers=_headers, + fields=_fields, + body=_body, + stream=stream, + timeout=timeout, + ) + + if skip_deserialization: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + else: + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) + else: + api_response = api_client.ApiResponseWithoutDeserialization(response=response) + + if not 200 <= response.status <= 299: + raise exceptions.ApiException(api_response=api_response) + + return api_response + + +class UpdateUser(BaseApi): + # this class is used by api classes that refer to endpoints with operationId fn names + + @typing.overload + def update_user( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> api_client.ApiResponseWithoutDeserialization: ... + @typing.overload + def update_user( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def update_user( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def update_user( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def update_user( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._update_user_oapg( + body=body, + path_params=path_params, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + +class ApiForput(BaseApi): + # this class is used by api classes that refer to endpoints by path and http method names + + @typing.overload + def put( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: typing_extensions.Literal["application/json"] = ..., + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> api_client.ApiResponseWithoutDeserialization: ... + @typing.overload + def put( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: typing_extensions.Literal[False] = ..., + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def put( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + skip_deserialization: typing_extensions.Literal[True], + content_type: str = ..., + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + ) -> api_client.ApiResponseWithoutDeserialization: ... + + @typing.overload + def put( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = ..., + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = ..., + ) -> typing.Union[ + api_client.ApiResponseWithoutDeserialization, + ]: ... + + def put( + self, + body: typing.Union[RequestBody.Schemas.application_json,], + content_type: str = 'application/json', + path_params: RequestPathParameters.Params = frozendict.frozendict(), + stream: bool = False, + timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, + skip_deserialization: bool = False, + ): + return self._update_user_oapg( + body=body, + path_params=path_params, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/user_username/put/response_for_400.py b/samples/openapi3/client/petstore/python/petstore_api/paths/user_username/put/response_for_400.py new file mode 100644 index 00000000000..7ec95a8627a --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/user_username/put/response_for_400.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from petstore_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/user_username/put/response_for_404.py b/samples/openapi3/client/petstore/python/petstore_api/paths/user_username/put/response_for_404.py new file mode 100644 index 00000000000..7ec95a8627a --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/user_username/put/response_for_404.py @@ -0,0 +1,28 @@ +import dataclasses +import urllib3 + +from petstore_api import api_client +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from petstore_api import schemas # noqa: F401 + + +@dataclasses.dataclass +class ApiResponse(api_client.ApiResponse): + response: urllib3.HTTPResponse + body: schemas.Unset = schemas.unset + headers: schemas.Unset = schemas.unset + + +response = api_client.OpenApiResponse( + response_cls=ApiResponse, +) diff --git a/samples/openapi3/client/petstore/python/test/test_paths/test_another_fake_dummy/test_patch.py b/samples/openapi3/client/petstore/python/test/test_paths/test_another_fake_dummy/test_patch.py index 827d02aaf11..9d8f03f742e 100644 --- a/samples/openapi3/client/petstore/python/test/test_paths/test_another_fake_dummy/test_patch.py +++ b/samples/openapi3/client/petstore/python/test/test_paths/test_another_fake_dummy/test_patch.py @@ -33,6 +33,7 @@ def tearDown(self): pass response_status = 200 + response_body_schema = patch.response_for_200.BodySchemas.application_json diff --git a/samples/openapi3/client/petstore/python/test/test_paths/test_fake/test_patch.py b/samples/openapi3/client/petstore/python/test/test_paths/test_fake/test_patch.py index e8d79727a09..870b0e17c51 100644 --- a/samples/openapi3/client/petstore/python/test/test_paths/test_fake/test_patch.py +++ b/samples/openapi3/client/petstore/python/test/test_paths/test_fake/test_patch.py @@ -33,6 +33,7 @@ def tearDown(self): pass response_status = 200 + response_body_schema = patch.response_for_200.BodySchemas.application_json diff --git a/samples/openapi3/client/petstore/python/test/test_paths/test_fake_additional_properties_with_array_of_enums/test_get.py b/samples/openapi3/client/petstore/python/test/test_paths/test_fake_additional_properties_with_array_of_enums/test_get.py index 7a2c11bd646..cfa08db5ba6 100644 --- a/samples/openapi3/client/petstore/python/test/test_paths/test_fake_additional_properties_with_array_of_enums/test_get.py +++ b/samples/openapi3/client/petstore/python/test/test_paths/test_fake_additional_properties_with_array_of_enums/test_get.py @@ -33,6 +33,7 @@ def tearDown(self): pass response_status = 200 + response_body_schema = get.response_for_200.BodySchemas.application_json diff --git a/samples/openapi3/client/petstore/python/test/test_paths/test_fake_classname_test/test_patch.py b/samples/openapi3/client/petstore/python/test/test_paths/test_fake_classname_test/test_patch.py index 51c483bdc08..9985e3de124 100644 --- a/samples/openapi3/client/petstore/python/test/test_paths/test_fake_classname_test/test_patch.py +++ b/samples/openapi3/client/petstore/python/test/test_paths/test_fake_classname_test/test_patch.py @@ -33,6 +33,7 @@ def tearDown(self): pass response_status = 200 + response_body_schema = patch.response_for_200.BodySchemas.application_json diff --git a/samples/openapi3/client/petstore/python/test/test_paths/test_fake_health/test_get.py b/samples/openapi3/client/petstore/python/test/test_paths/test_fake_health/test_get.py index dd6f2a54850..99336b22e73 100644 --- a/samples/openapi3/client/petstore/python/test/test_paths/test_fake_health/test_get.py +++ b/samples/openapi3/client/petstore/python/test/test_paths/test_fake_health/test_get.py @@ -33,6 +33,7 @@ def tearDown(self): pass response_status = 200 + response_body_schema = get.response_for_200.BodySchemas.application_json diff --git a/samples/openapi3/client/petstore/python/test/test_paths/test_fake_inline_composition_/test_post.py b/samples/openapi3/client/petstore/python/test/test_paths/test_fake_inline_composition_/test_post.py index fe16f7a4581..ce9d45bba39 100644 --- a/samples/openapi3/client/petstore/python/test/test_paths/test_fake_inline_composition_/test_post.py +++ b/samples/openapi3/client/petstore/python/test/test_paths/test_fake_inline_composition_/test_post.py @@ -33,8 +33,10 @@ def tearDown(self): pass response_status = 200 + response_body_schema = post.response_for_200.BodySchemas.application_json + response_body_schema = post.response_for_200.BodySchemas.multipart_form_data diff --git a/samples/openapi3/client/petstore/python/test/test_paths/test_fake_json_with_charset/test_post.py b/samples/openapi3/client/petstore/python/test/test_paths/test_fake_json_with_charset/test_post.py index 26105cad9f0..101b935d203 100644 --- a/samples/openapi3/client/petstore/python/test/test_paths/test_fake_json_with_charset/test_post.py +++ b/samples/openapi3/client/petstore/python/test/test_paths/test_fake_json_with_charset/test_post.py @@ -33,6 +33,7 @@ def tearDown(self): pass response_status = 200 + response_body_schema = post.response_for_200.BodySchemas.application_json_charsetutf_8 diff --git a/samples/openapi3/client/petstore/python/test/test_paths/test_fake_parameter_collisions_1_a_b_ab_self_a_b_/test_post.py b/samples/openapi3/client/petstore/python/test/test_paths/test_fake_parameter_collisions_1_a_b_ab_self_a_b_/test_post.py index 8bf351c3dc3..421890070ea 100644 --- a/samples/openapi3/client/petstore/python/test/test_paths/test_fake_parameter_collisions_1_a_b_ab_self_a_b_/test_post.py +++ b/samples/openapi3/client/petstore/python/test/test_paths/test_fake_parameter_collisions_1_a_b_ab_self_a_b_/test_post.py @@ -33,6 +33,7 @@ def tearDown(self): pass response_status = 200 + response_body_schema = post.response_for_200.BodySchemas.application_json diff --git a/samples/openapi3/client/petstore/python/test/test_paths/test_fake_pet_id_upload_image_with_required_file/test_post.py b/samples/openapi3/client/petstore/python/test/test_paths/test_fake_pet_id_upload_image_with_required_file/test_post.py index 23bc55d273b..6e5b607aaec 100644 --- a/samples/openapi3/client/petstore/python/test/test_paths/test_fake_pet_id_upload_image_with_required_file/test_post.py +++ b/samples/openapi3/client/petstore/python/test/test_paths/test_fake_pet_id_upload_image_with_required_file/test_post.py @@ -33,6 +33,7 @@ def tearDown(self): pass response_status = 200 + response_body_schema = post.response_for_200.BodySchemas.application_json diff --git a/samples/openapi3/client/petstore/python/test/test_paths/test_fake_query_param_with_json_content_type/test_get.py b/samples/openapi3/client/petstore/python/test/test_paths/test_fake_query_param_with_json_content_type/test_get.py index fe890aad78d..ac6f0142d0a 100644 --- a/samples/openapi3/client/petstore/python/test/test_paths/test_fake_query_param_with_json_content_type/test_get.py +++ b/samples/openapi3/client/petstore/python/test/test_paths/test_fake_query_param_with_json_content_type/test_get.py @@ -33,6 +33,7 @@ def tearDown(self): pass response_status = 200 + response_body_schema = get.response_for_200.BodySchemas.application_json diff --git a/samples/openapi3/client/petstore/python/test/test_paths/test_fake_refs_array_of_enums/test_post.py b/samples/openapi3/client/petstore/python/test/test_paths/test_fake_refs_array_of_enums/test_post.py index 28aedd8c2c0..ba0c6ca06f4 100644 --- a/samples/openapi3/client/petstore/python/test/test_paths/test_fake_refs_array_of_enums/test_post.py +++ b/samples/openapi3/client/petstore/python/test/test_paths/test_fake_refs_array_of_enums/test_post.py @@ -33,6 +33,7 @@ def tearDown(self): pass response_status = 200 + response_body_schema = post.response_for_200.BodySchemas.application_json diff --git a/samples/openapi3/client/petstore/python/test/test_paths/test_fake_refs_arraymodel/test_post.py b/samples/openapi3/client/petstore/python/test/test_paths/test_fake_refs_arraymodel/test_post.py index a252701f4ee..b86f2da8886 100644 --- a/samples/openapi3/client/petstore/python/test/test_paths/test_fake_refs_arraymodel/test_post.py +++ b/samples/openapi3/client/petstore/python/test/test_paths/test_fake_refs_arraymodel/test_post.py @@ -32,6 +32,7 @@ def tearDown(self): pass response_status = 200 + response_body_schema = post.response_for_200.BodySchemas.application_json diff --git a/samples/openapi3/client/petstore/python/test/test_paths/test_fake_refs_boolean/test_post.py b/samples/openapi3/client/petstore/python/test/test_paths/test_fake_refs_boolean/test_post.py index 3ac8fd5b4ae..bb2bd3ee472 100644 --- a/samples/openapi3/client/petstore/python/test/test_paths/test_fake_refs_boolean/test_post.py +++ b/samples/openapi3/client/petstore/python/test/test_paths/test_fake_refs_boolean/test_post.py @@ -32,6 +32,7 @@ def tearDown(self): pass response_status = 200 + response_body_schema = post.response_for_200.BodySchemas.application_json diff --git a/samples/openapi3/client/petstore/python/test/test_paths/test_fake_refs_composed_one_of_number_with_validations/test_post.py b/samples/openapi3/client/petstore/python/test/test_paths/test_fake_refs_composed_one_of_number_with_validations/test_post.py index d5963d8503a..78cec3a281c 100644 --- a/samples/openapi3/client/petstore/python/test/test_paths/test_fake_refs_composed_one_of_number_with_validations/test_post.py +++ b/samples/openapi3/client/petstore/python/test/test_paths/test_fake_refs_composed_one_of_number_with_validations/test_post.py @@ -32,6 +32,7 @@ def tearDown(self): pass response_status = 200 + response_body_schema = post.response_for_200.BodySchemas.application_json diff --git a/samples/openapi3/client/petstore/python/test/test_paths/test_fake_refs_enum/test_post.py b/samples/openapi3/client/petstore/python/test/test_paths/test_fake_refs_enum/test_post.py index fde250a49eb..63198567f3b 100644 --- a/samples/openapi3/client/petstore/python/test/test_paths/test_fake_refs_enum/test_post.py +++ b/samples/openapi3/client/petstore/python/test/test_paths/test_fake_refs_enum/test_post.py @@ -32,6 +32,7 @@ def tearDown(self): pass response_status = 200 + response_body_schema = post.response_for_200.BodySchemas.application_json diff --git a/samples/openapi3/client/petstore/python/test/test_paths/test_fake_refs_mammal/test_post.py b/samples/openapi3/client/petstore/python/test/test_paths/test_fake_refs_mammal/test_post.py index a692191f471..79df7b7f36d 100644 --- a/samples/openapi3/client/petstore/python/test/test_paths/test_fake_refs_mammal/test_post.py +++ b/samples/openapi3/client/petstore/python/test/test_paths/test_fake_refs_mammal/test_post.py @@ -32,6 +32,7 @@ def tearDown(self): pass response_status = 200 + response_body_schema = post.response_for_200.BodySchemas.application_json diff --git a/samples/openapi3/client/petstore/python/test/test_paths/test_fake_refs_number/test_post.py b/samples/openapi3/client/petstore/python/test/test_paths/test_fake_refs_number/test_post.py index b398b419ba9..4c9ca88b9d1 100644 --- a/samples/openapi3/client/petstore/python/test/test_paths/test_fake_refs_number/test_post.py +++ b/samples/openapi3/client/petstore/python/test/test_paths/test_fake_refs_number/test_post.py @@ -32,6 +32,7 @@ def tearDown(self): pass response_status = 200 + response_body_schema = post.response_for_200.BodySchemas.application_json diff --git a/samples/openapi3/client/petstore/python/test/test_paths/test_fake_refs_object_model_with_ref_props/test_post.py b/samples/openapi3/client/petstore/python/test/test_paths/test_fake_refs_object_model_with_ref_props/test_post.py index f6c51016d9e..b39ea9f1ddd 100644 --- a/samples/openapi3/client/petstore/python/test/test_paths/test_fake_refs_object_model_with_ref_props/test_post.py +++ b/samples/openapi3/client/petstore/python/test/test_paths/test_fake_refs_object_model_with_ref_props/test_post.py @@ -32,6 +32,7 @@ def tearDown(self): pass response_status = 200 + response_body_schema = post.response_for_200.BodySchemas.application_json diff --git a/samples/openapi3/client/petstore/python/test/test_paths/test_fake_refs_string/test_post.py b/samples/openapi3/client/petstore/python/test/test_paths/test_fake_refs_string/test_post.py index b7eaa838420..dc312d0ce1f 100644 --- a/samples/openapi3/client/petstore/python/test/test_paths/test_fake_refs_string/test_post.py +++ b/samples/openapi3/client/petstore/python/test/test_paths/test_fake_refs_string/test_post.py @@ -32,6 +32,7 @@ def tearDown(self): pass response_status = 200 + response_body_schema = post.response_for_200.BodySchemas.application_json diff --git a/samples/openapi3/client/petstore/python/test/test_paths/test_fake_upload_download_file/test_post.py b/samples/openapi3/client/petstore/python/test/test_paths/test_fake_upload_download_file/test_post.py index 5c044094664..ca075f4fbec 100644 --- a/samples/openapi3/client/petstore/python/test/test_paths/test_fake_upload_download_file/test_post.py +++ b/samples/openapi3/client/petstore/python/test/test_paths/test_fake_upload_download_file/test_post.py @@ -33,6 +33,7 @@ def tearDown(self): pass response_status = 200 + response_body_schema = post.response_for_200.BodySchemas.application_octet_stream diff --git a/samples/openapi3/client/petstore/python/test/test_paths/test_fake_upload_file/test_post.py b/samples/openapi3/client/petstore/python/test/test_paths/test_fake_upload_file/test_post.py index d877e592ac0..dbcfc80ffb0 100644 --- a/samples/openapi3/client/petstore/python/test/test_paths/test_fake_upload_file/test_post.py +++ b/samples/openapi3/client/petstore/python/test/test_paths/test_fake_upload_file/test_post.py @@ -33,6 +33,7 @@ def tearDown(self): pass response_status = 200 + response_body_schema = post.response_for_200.BodySchemas.application_json diff --git a/samples/openapi3/client/petstore/python/test/test_paths/test_fake_upload_files/test_post.py b/samples/openapi3/client/petstore/python/test/test_paths/test_fake_upload_files/test_post.py index b0123d36aea..2eb74b061bc 100644 --- a/samples/openapi3/client/petstore/python/test/test_paths/test_fake_upload_files/test_post.py +++ b/samples/openapi3/client/petstore/python/test/test_paths/test_fake_upload_files/test_post.py @@ -33,6 +33,7 @@ def tearDown(self): pass response_status = 200 + response_body_schema = post.response_for_200.BodySchemas.application_json diff --git a/samples/openapi3/client/petstore/python/test/test_paths/test_foo/test_get.py b/samples/openapi3/client/petstore/python/test/test_paths/test_foo/test_get.py index 809b636d6c3..b45082bfdd2 100644 --- a/samples/openapi3/client/petstore/python/test/test_paths/test_foo/test_get.py +++ b/samples/openapi3/client/petstore/python/test/test_paths/test_foo/test_get.py @@ -32,6 +32,7 @@ def tearDown(self): pass response_status = 0 + response_body_schema = get.response_for_default.BodySchemas.application_json diff --git a/samples/openapi3/client/petstore/python/test/test_paths/test_pet_find_by_status/test_get.py b/samples/openapi3/client/petstore/python/test/test_paths/test_pet_find_by_status/test_get.py index 2251f64e1b5..693f01478d8 100644 --- a/samples/openapi3/client/petstore/python/test/test_paths/test_pet_find_by_status/test_get.py +++ b/samples/openapi3/client/petstore/python/test/test_paths/test_pet_find_by_status/test_get.py @@ -33,8 +33,10 @@ def tearDown(self): pass response_status = 200 + response_body_schema = get.response_for_200.BodySchemas.application_xml + response_body_schema = get.response_for_200.BodySchemas.application_json diff --git a/samples/openapi3/client/petstore/python/test/test_paths/test_pet_find_by_tags/test_get.py b/samples/openapi3/client/petstore/python/test/test_paths/test_pet_find_by_tags/test_get.py index 48671bad4f4..df62362e2f1 100644 --- a/samples/openapi3/client/petstore/python/test/test_paths/test_pet_find_by_tags/test_get.py +++ b/samples/openapi3/client/petstore/python/test/test_paths/test_pet_find_by_tags/test_get.py @@ -33,8 +33,10 @@ def tearDown(self): pass response_status = 200 + response_body_schema = get.response_for_200.BodySchemas.application_xml + response_body_schema = get.response_for_200.BodySchemas.application_json diff --git a/samples/openapi3/client/petstore/python/test/test_paths/test_pet_pet_id/test_get.py b/samples/openapi3/client/petstore/python/test/test_paths/test_pet_pet_id/test_get.py index 78e02c339c2..6b7f77ef1b1 100644 --- a/samples/openapi3/client/petstore/python/test/test_paths/test_pet_pet_id/test_get.py +++ b/samples/openapi3/client/petstore/python/test/test_paths/test_pet_pet_id/test_get.py @@ -33,8 +33,10 @@ def tearDown(self): pass response_status = 200 + response_body_schema = get.response_for_200.BodySchemas.application_xml + response_body_schema = get.response_for_200.BodySchemas.application_json diff --git a/samples/openapi3/client/petstore/python/test/test_paths/test_pet_pet_id_upload_image/test_post.py b/samples/openapi3/client/petstore/python/test/test_paths/test_pet_pet_id_upload_image/test_post.py index b25f4ef89b2..9835c581cd1 100644 --- a/samples/openapi3/client/petstore/python/test/test_paths/test_pet_pet_id_upload_image/test_post.py +++ b/samples/openapi3/client/petstore/python/test/test_paths/test_pet_pet_id_upload_image/test_post.py @@ -33,6 +33,7 @@ def tearDown(self): pass response_status = 200 + response_body_schema = post.response_for_200.BodySchemas.application_json diff --git a/samples/openapi3/client/petstore/python/test/test_paths/test_store_inventory/test_get.py b/samples/openapi3/client/petstore/python/test/test_paths/test_store_inventory/test_get.py index e1363824ef8..ee0de2495a3 100644 --- a/samples/openapi3/client/petstore/python/test/test_paths/test_store_inventory/test_get.py +++ b/samples/openapi3/client/petstore/python/test/test_paths/test_store_inventory/test_get.py @@ -33,6 +33,7 @@ def tearDown(self): pass response_status = 200 + response_body_schema = get.response_for_200.BodySchemas.application_json diff --git a/samples/openapi3/client/petstore/python/test/test_paths/test_store_order/test_post.py b/samples/openapi3/client/petstore/python/test/test_paths/test_store_order/test_post.py index 69adb4340e5..be6b3bc52f8 100644 --- a/samples/openapi3/client/petstore/python/test/test_paths/test_store_order/test_post.py +++ b/samples/openapi3/client/petstore/python/test/test_paths/test_store_order/test_post.py @@ -33,8 +33,10 @@ def tearDown(self): pass response_status = 200 + response_body_schema = post.response_for_200.BodySchemas.application_xml + response_body_schema = post.response_for_200.BodySchemas.application_json diff --git a/samples/openapi3/client/petstore/python/test/test_paths/test_store_order_order_id/test_get.py b/samples/openapi3/client/petstore/python/test/test_paths/test_store_order_order_id/test_get.py index 55a5443d970..47cb31c45d6 100644 --- a/samples/openapi3/client/petstore/python/test/test_paths/test_store_order_order_id/test_get.py +++ b/samples/openapi3/client/petstore/python/test/test_paths/test_store_order_order_id/test_get.py @@ -33,8 +33,10 @@ def tearDown(self): pass response_status = 200 + response_body_schema = get.response_for_200.BodySchemas.application_xml + response_body_schema = get.response_for_200.BodySchemas.application_json diff --git a/samples/openapi3/client/petstore/python/test/test_paths/test_user_login/test_get.py b/samples/openapi3/client/petstore/python/test/test_paths/test_user_login/test_get.py index ad71bc1d4f3..dcf02006251 100644 --- a/samples/openapi3/client/petstore/python/test/test_paths/test_user_login/test_get.py +++ b/samples/openapi3/client/petstore/python/test/test_paths/test_user_login/test_get.py @@ -33,8 +33,10 @@ def tearDown(self): pass response_status = 200 + response_body_schema = get.response_for_200.BodySchemas.application_xml + response_body_schema = get.response_for_200.BodySchemas.application_json diff --git a/samples/openapi3/client/petstore/python/test/test_paths/test_user_username/test_get.py b/samples/openapi3/client/petstore/python/test/test_paths/test_user_username/test_get.py index c56b8bd1e4d..60ab583262e 100644 --- a/samples/openapi3/client/petstore/python/test/test_paths/test_user_username/test_get.py +++ b/samples/openapi3/client/petstore/python/test/test_paths/test_user_username/test_get.py @@ -33,8 +33,10 @@ def tearDown(self): pass response_status = 200 + response_body_schema = get.response_for_200.BodySchemas.application_xml + response_body_schema = get.response_for_200.BodySchemas.application_json diff --git a/samples/openapi3/client/petstore/python/tests_manual/test_deserialization.py b/samples/openapi3/client/petstore/python/tests_manual/test_deserialization.py index 7c0300fbcd1..ab89bfcd4f6 100644 --- a/samples/openapi3/client/petstore/python/tests_manual/test_deserialization.py +++ b/samples/openapi3/client/petstore/python/tests_manual/test_deserialization.py @@ -357,32 +357,32 @@ def test_deserialize_with_additional_properties_and_reference(self): def test_deserialize_NumberWithValidations(self): from petstore_api.model.number_with_validations import NumberWithValidations - from petstore_api.paths.fake_refs_number.post import _response_for_200 + from petstore_api.paths.fake_refs_number.post import response_for_200 # make sure that an exception is thrown on an invalid type value with self.assertRaises(petstore_api.ApiTypeError): response = self.__response('test str') - _response_for_200.deserialize(response, self.configuration) + response_for_200.response.deserialize(response, self.configuration) # make sure that an exception is thrown on an invalid value with self.assertRaises(petstore_api.ApiValueError): response = self.__response(21.0) - _response_for_200.deserialize(response, self.configuration) + response_for_200.response.deserialize(response, self.configuration) # valid value works number_val = 11.0 response = self.__response(number_val) - response = _response_for_200.deserialize(response, self.configuration) + response = response_for_200.response.deserialize(response, self.configuration) self.assertTrue(isinstance(response.body, NumberWithValidations)) self.assertEqual(response.body, number_val) def test_array_of_enums(self): from petstore_api.model.array_of_enums import ArrayOfEnums - from petstore_api.paths.fake_refs_array_of_enums.post import _response_for_200 + from petstore_api.paths.fake_refs_array_of_enums.post import response_for_200 from petstore_api.model import string_enum data = ["placed", None] response = self.__response(data) - deserialized = _response_for_200.deserialize(response, self.configuration) + deserialized = response_for_200.response.deserialize(response, self.configuration) assert isinstance(deserialized.body, ArrayOfEnums) expected_results = ArrayOfEnums([string_enum.StringEnum(v) for v in data]) assert expected_results == deserialized.body diff --git a/samples/openapi3/client/petstore/python/tests_manual/test_object_model_with_ref_props.py b/samples/openapi3/client/petstore/python/tests_manual/test_object_model_with_ref_props.py index 42fc674cd2d..f6dde99f670 100644 --- a/samples/openapi3/client/petstore/python/tests_manual/test_object_model_with_ref_props.py +++ b/samples/openapi3/client/petstore/python/tests_manual/test_object_model_with_ref_props.py @@ -36,9 +36,9 @@ def testObjectModelWithRefProps(self): assert inst["myNumber"] == 15.0 assert isinstance(inst["myNumber"], NumberWithValidations) assert inst["myString"] == 'a' - assert isinstance(inst["myString"], ObjectModelWithRefProps.MetaOapg.properties.myString) + assert isinstance(inst["myString"], ObjectModelWithRefProps.MetaOapg.properties.myString()) assert bool(inst["myBoolean"]) is True - assert isinstance(inst["myBoolean"], ObjectModelWithRefProps.MetaOapg.properties.myBoolean) + assert isinstance(inst["myBoolean"], ObjectModelWithRefProps.MetaOapg.properties.myBoolean()) assert isinstance(inst["myBoolean"], BoolClass)